Problem with fetching instances from device
- Anonymous3 years ago
I recommend using the SDK. Also, instead of x['dataSourceId'], try x['id']. The dataSourceId is the global ID for the datasource. The instances are not tied to that. They are tied to the "hdsId", which is the ID of the datasource as it's applied to that device and it's unique for that one device.
Because of this unique ID on the device, it's actually quite tedious to get all the instances for a particular datasource across multiple devices. You have to make one call for the hdsId, then another call to get the instances. Another option would be to just make a call to /device/devices/{id}/instances and fetch all the instances on the device. That response contains both the hdsId and the dataSourceId, so if you know the global ID of the datasource(s), you can then filter in script.