[ANSWERED]: Device IDs missing from the Device List?

Posted on
Thu Nov 27, 2014 3:17 pm
indy offline
Posts: 23
Joined: Nov 15, 2014
Location: Auckland, New Zealand

[ANSWERED]: Device IDs missing from the Device List?

Hi

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.

Posted on
Thu Nov 27, 2014 7:26 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Device IDs missing from the Device List?

Right now there is no way to get a list that includes the IDs, but we have on our ToDo list a pretty large overhaul of the RESTful API. It will include lots of new functionality – including the device IDs you are requesting.

Image

Posted on
Mon Dec 01, 2014 5:22 pm
indy offline
Posts: 23
Joined: Nov 15, 2014
Location: Auckland, New Zealand

Re: [ANSWERED]: Device IDs missing from the Device List?

Thanks Matt.

Look forward to the overhaul.

For now, I've just set up my application to work around it and retrieve all the details by making individual calls to each of the devices in my setup.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest