Does the API work for updating a Collector's customProperties? (V1)
I have some code that snags the custom properties from a collector (/setting/collectors) and then I'm updating or adding one, and then I use /setting/collectors with the collector ID to make an update.
And my code works perfectly if I update the description and put the description as the patchFields. I can update my description to "MEH" or whatever.
But as soon as I try to set the customProperties, nothing happens. The data is just like it needs to be. I even get a response of 200.
So I can update description but not customProperties. I wonder if I'm doing it right, maybe you cant update them in bulk (total replace)?
Any thoughts? Code fragment below.
if c_update_required == True:
print ("Update REQUIRED")
patch_data = '{\'customProperties\': ' + str(new_collector_properties) + '}'
#patch_data = '{"description":"' + 'MEH' + '"}'
http_verb ='PATCH'
print (patch_data)
resource_path = '/setting/collectors/'+collector_id
query_params ='?patchFields=customProperties'
#query_params ='?patchFields=description'
url = 'https://'+ Company +'.logicmonitor.com/santaba/rest' + resource_path + query_params
epoch = str(int(time.time() * 1000))
requestVars = http_verb + epoch + patch_data + resource_path
hmac1 = hmac.new(AccessKey.encode(),msg=requestVars.encode(),digestmod=hashlib.sha256).hexdigest()
signature = base64.b64encode(hmac1.encode())
auth = 'LMv1 ' + AccessId + ':' + signature.decode() + ':' + epoch
headers = {'Content-Type':'application/json','Authorization':auth}
patch_response = lm_session.patch(url, data=patch_data, headers=headers)
if patch_response.ok:
print("Success")
Oh and below you can see the customProperties I get back when snagging it, and what I have it set to when I try to set it. I'm sure its right. BUT I am completely stumped. Success 200. No change.
GET DATA: customProperties': [{'name': 'bar', 'value': 'Melvin NoName'}, {'name': 'foo', 'value': '123'}]
PATCH DATA: 'customProperties': [{'name': 'bar', 'value': 'Melvin NoName'}, {'name': 'foo', 'value': '123'}, {'name': 'mynew.clientID', 'value': '1037524379'}]
Any ideas? Description works, customProperties does nothing, but both give status 200.