Array of Device states from API

Is there an API endpoint to get an array of the most the recent device states from a collection of devices matching a tag?

I’d like to query a group of devices and get the most recent states for selected attributes into an array.

Hi Paul,

I built out a workflow to do this, you can find the walkthrough below. Based on your use case, I believed this to be the easiest way to accomplish this goal.

I still have the same workflow as this post, and have added a Device: Get node, a Function node, and a Loop. I first use the Device: Get to query the Device Tags, return the multiple devices that match, and those devices are placed on the payload.

Within my function node, I loop through and pull out the device IDs.


18%20AM

Then I use a loop node, and set the source path to the deviceId array I just created.

Then from within my loop I include the nodes I built out in this example to get each device’s last state data onto the payload.


Then I can see the every device’s last state for the tag I selected.
33%20AM

Hopefully this helps,
Julia

Great. Would you mind to attach the workflow export - or PM it - to make it easier to experiment with your example?

1 Like