Hello,
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?
Article Comments
Always check the ResponseUri from your request.
This will give you the "device not found" and other errors that might occur.
Jul, 2011 - Permalink
@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
and
'(Property not found)' === does exist
or do you recommend simply check against the existence of the <error> and <result> tags?
Jul, 2011 - Permalink
Try the GetObjectsproperty function:
The reply is
Jul, 2011 - Permalink