Hey Folks,
I've been playing around with the cnMaestro API today and have been really enjoying it, but I haven't been able to determine the magic incantation to get the Update Device Configuration endpoint working correctly yet.
I sifted through the API documentation and the existing forum posts and wasn't able to pick up anything more than what was in the docs, so I'm hoping someone here can help or at least point me in the right direction.
I am running cnMaestro on-prem v2.2.1-r32 and am attempting to update some basic fields on a test AP to get my sea legs with the API. I have successfully performed actions like onboarding, rebooting, and getting statistics / performance data from this specific AP but am still having troubling updating fields.
I'm using Python3 for interacting currently, and I followed the body format as laid out in the docs like so (apologies for scrubbing the data into stupid numbers - I swear I have real IPs and VLANs in the real deal):
import requests headers = { 'Content-Type': "application/json", 'Accept': "application/json", 'Authorization': "Bearer GREATTOKENWOW", } body = { 'name': 'TEST_AP_NAME_FIELD', 'latitude': '41.00000', 'longitude': '-83.00000', 'overrides': { "auto_set":{ "network": 'false', }, 'dns_server_1': '8.8.8.8', 'dns_server_2': '1.1.1.1', 'vlans': [{ 'id': 1111, 'ip': '12.34.56.246', 'mask': '12.34.56.224', 'mode': 'static', }], }, }
I have tried to submit the HTTP PUT request in both of the following ways with the successive returns:
>>> requests.put('https://cnmaestro.amplex.net/api/v1/devices/0a-00-3e-a0-d4-74', body, headers=headers, verify=False).json() {'sTime': 1571314999474, 'error': {'message': 'SyntaxError: Unexpected token n in JSON at position 0', 'cause': 'SyntaxError: Unexpected token n in JSON at position 0', 'level': 'error', 'supportUrl': ''}}>>> requests.put(‘https://cnmaestro.amplex.net/api/v1/devices/0a-00-3e-a0-d4-74’, headers=headers, params=body, verify=False).json()
{‘message’: ‘Input Validation Error for incoming request’, ‘cause’: ‘INTERNAL’}
>>>
I know the direct body payload is technically the documented format, but I figured passing the dictionary in params was worth a shot for giggles since it worked on onboarding.
The documentation states that overrides.auto_set.network must be set to FALSE for the overrides and vlan statements, which it is. I have also tried setting only overrides.auto_set.network in it's own call for the sake of being thorough and encountered the same errors.
Anyone see where I'm injecting stupid into the procedure? I'd appreciate any insight anyone can provide.
Thanks!
Jacob