I've tried to find information on this on the forums, but haven't seen anything that can help. So pardon if I'm repeating...
I'm making an API call to my local Indigo server: http://localhost:8176/devices.xml
All I see is something like this:
- Code: Select all
<devices>
<device href="/devices/Family%20Room%20-%20Floor%20Lamp.xml">Family Room - Floor Lamp</device>
<device href="/devices/Family%20Room%20-%20Humidity.xml">Family Room - Humidity</device>
<device href="/devices/Family%20Room%20-%20Luminance.xml">Family Room - Luminance</device>
<device href="/devices/Family%20Room%20-%20Motion%20Sensor.xml">Family Room - Motion Sensor</device>
</devices>
In order to find out the actual ID for each of these devices, I have to do a call for each of the four devices.
Is there a simpler way to get all device ids by one HTTP call? Something like:
- Code: Select all
<devices>
<device id="4123123" href="/devices/Family%20Room%20-%20Floor%20Lamp.xml">Family Room - Floor Lamp</device>
<device id="2253123" href="/devices/Family%20Room%20-%20Humidity.xml">Family Room - Humidity</device>
<device id="4323123" href="/devices/Family%20Room%20-%20Luminance.xml">Family Room - Luminance</device>
<device id="4523123" href="/devices/Family%20Room%20-%20Motion%20Sensor.xml">Family Room - Motion Sensor</device>
</devices>
I'd think that having the id node for each device should be the default way of returning the information along with anything else like the href URL?
Else in the documentation I've read that the correct way to get hold of a device in the Indio Python shell is to use the device id, and not the name http://wiki.indigodomo.com/doku.php?id=indigo_5_documentation:plugin_scripting_tutorial. The page recommends that:
However, the preferred lookup mechanism is to use the object's ID which can be retrieved by control-clicking on the object name in Indigo's Main Window. By using the ID you ensure the object will be found even if its name is changed.
And as a developer I know that it is always better to use a unique identifier to get a handle on the objects. So I'm just wondering if there is any way I can force the Restful API to return ids with the list.
And if not, then what is the best way in the Indigo Restful API to accomplish that.
Thanks.