Network Management

Reply
Highlighted
Moderator

Re: Activate API management

You need to use form data, not JSON payload.



If this response is more than 1 year old, it may no longer be accurate. Please consult official Aruba documentation, TAC or your Aruba SE.

| Aruba Alumni | @timcappalli | timcappalli.me |

Highlighted
Occasional Contributor II

Re: Activate API management

I used form data with request library and not working either

 

string_query={"devices" : [{"mac" : "20:4C:03:04:31:80",
"deviceName" : "nombre de prueba",
"folderName": "XXXXXX" }]}


try:
f = requests.post(line+"/api/ext/inventory.json?action=update", files={key: str(value) for key, value in string_query.items()},headers=......

 

json POST parameter must be supplied for update action."}]}

Occasional Contributor II

Re: Activate API management

Hello all,

 

This is working;

 

curl -d 'json={"devices" : ["00:1A:1E:29:73:B2","00:1A:1E:29:73:B2"]}' -b Activate-cookie.txt -v https://activate.arubanetworks.com/api/ext/inventory.json?action=query --trace /dev/stdout

 

but this python 3 script is not:

 

string_query={"devices" : [ "00:1A:1E:29:73:B2","00:1A:1E:29:73:B2" ]}
headers={
"Cookie" : cookie,
"Content-Type": "application/x-www-form-urlencoded",
"User-Agent":"curl/7.47.0",
"charset":"UTF-8",
"Connection": "Keep-Alive",
"Accept": "*/*"
}

response = requests.post(line+"/api/ext/inventory.json?action=query&deviceFilter=basicData&addDate=06-16-2017",data=jsonbody_url,headers=headers)
print(response.text)

 

Also I am taking a look to the Java sample code in the doc and I found this:

if (status != 200) System.out.println("login failed code[" + status + "]"); else {

         request.sendRequest("/api/ext/folder.json?action=query", null);            

          System.out.println(request.getResponseBody());

         String post = "json={\"folders\":[\"72ffcf7c-6242-415a-84a4-        f64606af3c9c\"]}";

         request.sendRequest("/api/ext/inventory.json?action=query",      post);

        System.out.println(request.getResponseBody());

 

      public void sendRequest(String api, String post)

 

       .....

 

Looks like you are doing 2 request to the server, first one with a Get and a second one with a POST

 

Can you clear this up?

Search Airheads
cancel
Showing results for 
Search instead for 
Did you mean: