Do you have an example of grabbing json data from the api I want to get all sensors / values from a device ID, can't quite figure it out.


Article Comments

Hello,

Thank you for your message.

To get all sensors from a specific device, I invite you to use the following API call by replacing all information in uppercase with the corresponding value:

https://PRTGSERVER/api/table.json?content=sensors&columns=objid,name,probe,group,favorite,lastvalue,device,downtime,downtimetime,downtimesince,uptime,uptimetime,uptimesince,knowntime,cumsince,lastcheck,lastup,lastdown,schedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*&filter_parentid=DEVICEID&username=PRTGUSER&passhash=PASSHASH

If you want to get the data in CSV format, use this API call instead:

https://PRTGSERVER/api/table.xml?output=csvtable&content=sensors&columns=objid,name,probe,group,favorite,lastvalue,device,downtime,downtimetime,downtimesince,uptime,uptimetime,uptimesince,knowntime,cumsince,lastcheck,lastup,lastdown,schedule,basetype,baselink,notifiesx,intervalx,access,dependency,position,status,comments,priority,message,parentid,tags,type,active&count=*&filter_parentid=DEVICEID&username=PRTGUSER&passhash=PASSHASH

Then, simply rename the generated file to .csv to open it with Excel.

For the passhash, you can find the one linked to your account under Setup > Account Settings > My Account by using the button Show passhash.

If you have questions, do not hesitate.

Regards.


Mar, 2022 - Permalink