Hello,
AOS 8.13.1.1
Multi-controller cluster and failover cluster with MCR and standby MCR (x2)
First off - I'm not very experienced with programming so I'm sure this is something I'm doing wrong rather than a bug etc!
I'm trying to use the API to run the 'apmove' command.
I successfully get the UIDARUBA and X-CRSF-Token (I'm a little confused about if and when I need the X-CSRF-Token but the API developer tool puts that in the header so I am too).
For info I can run this successfully from the API reference page using the 'Try It Out' option, so I know it is possible!
This is the relevant snip of what I have so far:
url = f"https://{ctlr_ip}:4343/v1/configuration/object/apmove_ap"
for ap in ap_list:
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
params = {"config_path":"/mm","UIDARUBA":str(uidaruba)}
querystring = urllib.parse.urlencode(params)
full_url = f"{url}?{querystring}"
print(f"full_url = {full_url}")
payload = {
"ap-mac": ap,
"target_v4": target_ip,
"target_v6": ''
}
print(f"payload = {payload}\n")
headers = {
"Content-Type": "application/json",
"X-CSRF-Token": x_csrf,
"Cookie" : f"SESSION={uidaruba}"
}
print(headers)
try:
response = requests.post(full_url, json=payload, headers=headers, verify=False)
print(response)
print(response.text)
But this is what I get when I run it (with some redactions):
full_url = https://<correct url>:4343/v1/configuration/object/apmove_ap?config_path=%2Fmm&UIDARUBA=<uid looks normal>
payload = {'ap-mac': 'AP MAC is correct', 'target_v4': 'cluster IP address', 'target_v6': ''}
{'Content-Type': 'application/json', 'X-CSRF-Token': '<x-csrf token>', 'Cookie': 'SESSION=<uid>'}
<Response [200]>
{
"Error": "Exception raised while processing request"
}
Is it true to say that authentication is working as I get a 200 response? In which case is the issue somehow with running the endpoint URL itself?
Any help much appreciated.
Guy
-------------------------------------------