[racktables-users] racktables API

  • From: J Lee <juleedev@xxxxxxxxx>
  • To: racktables-users@xxxxxxxxxxxxx
  • Date: Tue, 28 Aug 2012 12:00:10 -0400

I've just reviewed the latest version of the racktables API and first off,
I’d like to say that I think you've done a really nice job, Ian. Thank you
very much.  In the first version, the get objects was a little "limited" in
that it wasn't returning any of the attributes like hardware name etc.
So we were spinning our own code to do that. Now I see that you're
returning all the attributes.  That's great!

One thing I was wondering about:

Do you think having the following functionality would be useful to anyone
else?  I've created a routine to get objects based on their types.   The
code looks like this:

     case 'get_objectsoftype':
        require_once 'inc/init.php';;
        assertUIntArg ("object_type_id", TRUE);

                $objects = listCells ('object');
                $returnObjects = Array();
                $objectType = $_REQUEST['object_type_id'];
                foreach ($objects as $object) {
                       if
(trim($object['objtype_id'])===(string)$objectType) {
                           array_push($returnObjects,$object);
                        }
                }
                header ('Content-Type: application/json; charset=UTF-8');
                echo json_encode($returnObjects);
                break;

We are using this to limit our data to network switches, waps, or routers
etc.
Of course, this routine probably should change to also return all attribs
as you are now doing with the new get_objects.
Anyways.  Thanks again for the API.
j.

Other related posts:

  • » [racktables-users] racktables API - J Lee