If you’ve got postman working, you’re doing well. That’s where most people trip up.
So, you need to construct this URL to do your patch:
/device/devices/{deviceId}/devicedatasources/{hdsId}/instances/{id}
To do that, you need three variables: deviceId, hdsId, and id. Sounds like you already have deviceId.
To get hdsId (hardware datasource id, don’t ask why it’s called that, it doesn’t matter), you’ll need to do a GET on :
/device/devices/{deviceId}/devicedatasources?filter=dataSourceName:"Microsoft_SQLServer_GlobalPerformance"&fields=id,dataSourceName
The response will give you, as you’ve seen, the list of datasources on that device, but with the filter specified above, you should only get a response if there’s been an instance discovered on the device whose device ID is {deviceId}. If there’s not one there, you have chosen the id of a device that doesn’t have an instance for that datasource.
From there, you can use the id from the response (which is different for every device, yay!) to get the list of instances that you will be attempting to patch. Do a GET on:
/device/devices/{deviceId}/devicedatasources/{hdsId}/instances
The id shown in the response for each instance is the id that should go in the PATCH url.
Also, when you go to do your patch, there’s a query parameter: opType that will affect how your patch works, especially when it comes to properties. The swagger docs don’t even tell you what the possible values are much less what they do, so here it is:
Define custom properties for this device. Each property needs to have a name and a value. To add or update just one or a few device properties in the customProperties object, but not all of them, you’ll need to additionally use the opType query parameter. The opType query parameter can be set to add, refresh or replace. opType=add indicates that the properties included in the payload will be added, but all existing properties will remain the same. opType=replace indicates that the properties included in the request payload will be added if they don’t already exist, or updated if they do already exist, but all other existing properties will remain the same. opType=refresh indicates that the properties will be replaced with those included in the request payload.
So, the possible values are add, replace, and refresh.
Add - You specify the properties you want to add. Existing properties are untouched. New properties are added. If your payload has a property that already exists, that property isn’t modified.
Replace - You specify the properties you want to update. New properties are added. If your payload has a property that already exists, that property is updated to match your payload.
Refresh - This is the nuclear option which will delete all properties and replace them with the properties in your payload.
You’d probably want to do replace.