8 Replies Latest reply on May 29, 2016 9:03 PM by Steven Klassen

    Create custom dashboard based on api results

    jmsanch

      So I'm trying to expand on this post Orion API via PHP.  The post is about 2 years old, but I tried to follow it up with what I've been working.  I haven't received any responses, so I figured I would just start a new thread and see what happens.  So based off that post I shorted it up a bit, turning his callapi into another function.  The result is this:

              <?php include 'includes/functions.php';

              $data = array('query' => "SELECT Sysname,StatusLED  FROM Orion.Nodes WHERE StatusLED = 'Down.gif'");

              $jdata = json_encode($data);

             $result = array(CallAPI($url, $jdata));

             foreach ($result as $r) {

                echo $r;

               echo "<br>";

             }

      And this works for the most part.  It displays {"results":[{"Sysname":"Firewall","StatusLED":"Down.gif "},{"Sysname":"Server","StatusLED":"Down.gif "}]}.  But thats not pretty.  When its finished I would like to build a custom display based off this information, and some conditional statements based on StatusLED.  So Im not sure how to parse this data in its form, through in some HTML and CSS, and make it look pretty.  I've tried putting it in array, and echoing it like so echo $result['Sysname'] for example, but that doesn't seem to work well.