Quantcast
Channel: Spiceworks Community
Viewing all articles
Browse latest Browse all 18

Where is the Service State in SpiceWorks API?

$
0
0

So here's where I'm at right now. I'm testing out the functionality of Query and just making sure it works before I write any more complicated code. Unfortunately, my output seems to be null? I don't know if it's because my "class" is incorrectly labeled or what, but I'm getting nothing for the output.

  update: function (element, options) {
    try {
      var queryCond = "computer_id = '56' AND service_id = '236'";
      SPICEWORKS.data.query( {
        serviceResult: {
          class: 'Service Installations', include: 'service_installations', conditions: queryCond
        }
      }, function (resultHash) {
        var myService = resultHash['serviceResult']; // Store query result in a var
        myService.each(
          function (myService) {
            element.innerHTML = 'Service state is ' + myService.state;
          }
        );
      });
    }
    catch(err){
      alert(err);
    }
  }

Viewing all articles
Browse latest Browse all 18

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>