What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags

View all Tags

I need a boolean answer to an API query to determine if a device ID is valid.




Using: http://yourserver/api/table.xml?content=sensortree&id=7788 I can retrieve exactly what I need to determine the ID of available sensors for a specific device.

I can not find a method that returns a simple "device not found" when supplied an invalid device id.

Ideally http://yourserver/api/table.xml?content=sensortree&id=bogus_id would return that.

Is there a simple, fast, supported way to do this?

api prtg query

Created on Jul 21, 2011 2:17:31 PM

3 Replies

Accepted Answer



Try the GetObjectsproperty function:


The reply is

<?xml version="1.0" encoding="UTF-8" ?> 
<error>Sorry, the selected object cannot be used here or it does not exist.</error> 

Created on Jul 22, 2011 9:54:40 AM by  Dirk Paessler [Founder Paessler AG] (11,025) 3 6



Always check the ResponseUri from your request.

This will give you the "device not found" and other errors that might occur.

Created on Jul 22, 2011 10:05:51 AM



@Gerard Feijth - sadly that information does not appear in the return headers or return url for these particular requests (using cURL and php).

@Dirk Paessler - This works perfectly and is very fast, thank you.

Is it safer to use the strings:

'Sorry, the selected object cannot be used here or it does not exist.' === does not exist


'(Property not found)' === does exist

or do you recommend simply check against the existence of the <error> and <result> tags?

Created on Jul 22, 2011 3:20:29 PM

Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.