8 years ago
Rest API and Powershell
So I have had pretty good luck converting the Python examples to Powershell.
The one thing I can not figure out how to do is return volume usage for a specific host.
Anyone got any example ...
Hi Gary - DataSources have two ids: one id for the DataSource template, and another id for each Device-DataSource combinations (for each device it's applied to). So in this case, 94 is the id of the DataSource itself, but what you want is the id of the DataSource instantiated for device 1. So in your example, you want the 'id' field (58), which corresponds to the unque device-datasource combination, instead of the dataSourceId field (94). Additionally, the instances themselves have ids, so you'd need to get the instance id to put in the resource path if you wanted data for one specific instance. I recommend omitting the instance id from the resource path if you don't mind getting data for multiple instances. So the resource path should be:
$resourcePath = '/device/devices/1/devicedatasources/58/data'
Otherwise, you could make a GET request to /device/devices/1/devicedatasources/58/instances to get instance ids. Does that make sense?
Thanks,
Sarah