Forum Discussion
Going to drop an update that this script ran great for devices not in the cloud. The calls to update our 100+ devices in Azure returned a 200 OK without changing the content of the system.categories field.
I did try different find-replace or escape functions or even changing to v3 with no improvement yet. The Swagger for v3 API also talks about system.categories being an exception.
<# Request Info #>
$httpVerb = 'PATCH'
#$resourcePath = '/device/devices/' + $item.id #v1 query
#$queryParams = '?patchFields=customProperties&opType=replace' # v1 query
$resourcePath = '/device/devices/' + $item.id + '/properties/system.categories' #v3 query
$queryParams = '?v=3' # v3 query
#$data = '{"customProperties":[{"name":"system.categories","value":"' + $item.NewData + '"}]}' # v1 data payload
$data = '{"value":"' + $item.newData + '"}' # v3 data payload
# v3 data mangling
#$value = [uri]::EscapeDataString($item.NewData)
#$value = $item.newData.replace('/','%2F')
#$value = $item.newData.replace('/','%252F')
#$data = '{"customProperties":[{"name":"system.categories","value":"' + $value + '"}]}' # v1 data payload
#$data = '{"value":"' + $value + '"}' # v3 data payload
The audit log in LogicMonitor has records of my calls but the middle is blank. I did update my case with LogicMonitor Support - this is an interesting one.
Update host US-NC:vm:myserver, , via API token xyz123
Can't edit but I think it has to do with the slash in one of the categories - that's the reason I have been trying different solutions for the '/'.
value
-----
ZertoAppliance,collectorDataSources,Azure/VirtualMachine
Related Content
- 4 months ago
- 10 months ago
- 2 years ago