I would like to read the current state of sensor by using HTTP API. is that possible? I would like to pass the Object ID.

thanks for help


Article Comments

Hi,
yes it is possible using the API to get the actual sensor state. In the API Documentation on your PRTG installation under Setup | PRTG API on tab Live Data the API call getobjectstatus is described which allows you to gather several information about a object in PRTG using the object ID.
A example call might look like follows:

/api/getobjectstatus.htm?id=objectid&name=status&show=text

Where all values described in section Supported Output Columns can be used in the name parameter of the API call.
Best regards


Mar, 2013 - Permalink

Hi,

Thank you it works fine. How can i login, because now i become "Unauthorized". Do I have to sign up on the website? or I may have a different set up a session?


Mar, 2013 - Permalink

Where exactly do you get the Unauthorized message?


Mar, 2013 - Permalink

When i call the following page:

https://xxx/api/getobjectstatus.htm?id=13015&name=status&show=text

Mar, 2013 - Permalink

Please try adding the parameters username and password resp. passhash to the requested URL. You would then end up with something like the following:

https://xxx/api/getobjectstatus.htm?id=13015&name=status&show=text&username=YOUR_USERNAME&password=YOUR_PASSWORD

or

https://xxx/api/getobjectstatus.htm?id=13015&name=status&show=text&username=YOUR_USERNAME&passhash=YOUR_PASSHASH

The passhash can be obtained from your user account settings from the PRTG web interface at Setup | My Account.


Mar, 2013 - Permalink

Thanks it's work fine!:) But how can i display this in c# or vb.net? Is there some example code?


Mar, 2013 - Permalink

There is no example code available for the moment. Sorry. You might have a look at this HowTo which describes fetching of websites.
Best regards


Mar, 2013 - Permalink