cancel
Showing results for 
Search instead for 
Did you mean: 

XCC API PUT

XCC API PUT

StephanH
Valued Contributor III

Hello,

I am trying to change values on an AP via XCC API. According the API doc (https://documentation.extremenetworks.com/Extreme%20Campus%20Controller/v5.16/API/index_rest_gateway...)  three values are required:

serialNumber, hardwareType, apName

accordingly, I send the following call:

changes = {"serialNumber" : "2011Y-1111100000","hardwareType" : "AP310i-WR", "apName" : "2011Y-1111100000"", "description" : "ForTesing"}

 resp = requests.put(url + "management/v1/aps/2011Y-1111100000"", json=changes, headers=headers, verify=False)

And I receive the following:

{'errors': [{'errorMessage': 'Validation of "ip" failed; ip_addr/gateway/netmask should be set', 'resource': 'AccessPointManager configureAccessPoint.arg1.ip', 'errorCode': 422, 'invalidValue': 'com.extremenetworks.exol.exolcore.restapi.elements.AccessPointElement@571f4c81'}, {'errorMessage': 'Validation of "radios" failed; may not be null', 'resource': 'AccessPointManager configureAccessPoint.arg1.radios', 'errorCode': 422, 'invalidValue': ''}]}
 

It seems I have add more values to the request. But I can’t see that requirement in the API docu. In addition I don't want to add so many values when I only want to change the description.

 

Has anyone tried to change individual values successfully?

 

Regards Stephan
1 ACCEPTED SOLUTION

Miguel-Angel_RO
Valued Contributor II

Stephan,

I changed the channels of hundreds AP’s at once with the API very easily.

You must GET the current config and modify the parameter you want to change and then send back the full config adapted.

Here a piece of code I use:

r = requests.get(server + "/management/v1/aps/{0}".format(AP['serialNumber']), headers=headers, verify=False)
body = json.loads(r.content)
if AP['Channel_2.4GHz']:    body['radios'][RADIO_MAPPING[body['hardwareType']]['2G']]['reqChannel'] = AP['Channel_2.4GHz']    body['radios'][RADIO_MAPPING[body['hardwareType']]['2G']]['useSmartRf'] = Falser = requests.put(server + "/management/v1/aps/{0}".format(body['serialNumber']), json=body, headers=headers, verify=False)if r.status_code != 200:    # This means something went wrong.    RESULT += 'error on {}\n'.format(AP)else:    RESULT += 'OK for {}\n'.format(AP)print('RESULT\n', RESULT)

Enjoy

Mig

View solution in original post

5 REPLIES 5

Miguel-Angel_RO
Valued Contributor II

Stephan,

Be carefull with some bugs depending on the versions.

Don’t play with the led-status, it could crashes the GUI, the bug seems not present on all releases/platforms and is to be corrected in the next release.

If you change that, go via CLI on the XCC to change back the led-status to recover the GUI.

Mig

StephanH
Valued Contributor III

Hello Mig,

 

thank you for the update. I have tried reading and writing the complete config.

Much overhead but works.

Regards Stephan

Miguel-Angel_RO
Valued Contributor II

Stephan

I got that info from the support

Mig

StephanH
Valued Contributor III

Hi Mig,

 

thank you for the fast answer. I suspected that I would have to read and write the whole config, based on the response I got to the request.

But that is not described in the documentation, is it?

Regards Stephan
GTM-P2G8KFN