Network Management

last person joined: yesterday 

Keep an informative eye on your network with IMC and AirWave network management solutions.
Expand all | Collapse all

Activate API - trouble using Curl to move AP into Folder

This thread has been viewed 17 times
  • 1.  Activate API - trouble using Curl to move AP into Folder

    Posted Sep 03, 2021 12:34 PM
    Hoping someone has figured this out already. I can use Curl to obtain a token, and then use that to query Activate and return details on a specific AP, all good.

    However when i try the following to move a single AP into an existing Folder, i'm getting an error.
    I think it is seeing the colon in the mac address as a separator, but unsure what the fix for that is...
    (mac address and folderId changed for sharing purposes only)

    cmd line (from a windows shell)
    curl -d 
    "json={"devices" : [{"mac" : "AA:BB:CC:DD:EE:FF","folderId" : "74ce1675-9b03-4a71-a1ad-213d0fce26b3" }]}" -b Activate-cookie.txt https://activate.arubanetworks.com/api/ext/inventory.json?action=update

    error output:
    {"failure": "Expected a ',' or '}' at character 22 of {devices : [{mac : AA:BB:CC:DD:EE:FF,folderId : 74ce1675-9b03-4a71-a1ad-213d0fce26b3 }]}"}


    Thanks in advance for any help.


    --------
    Roger
    --------


  • 2.  RE: Activate API - trouble using Curl to move AP into Folder

    Posted Sep 05, 2021 09:02 AM
    Do you have a link to API doc ?

    the json is valid... but need to be good with API...

    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------



  • 3.  RE: Activate API - trouble using Curl to move AP into Folder

    Posted Sep 06, 2021 04:11 AM
    Hello

    I have been using the API guide within this document
    https://community.arubanetworks.com/HigherLogic/System/DownloadDocumentFile.ashx?DocumentFileKey=40556cf2-e145-4a1e-8c59-d8e6d9276338

    --------
    Roger
    --------



  • 4.  RE: Activate API - trouble using Curl to move AP into Folder

    Posted Sep 09, 2021 04:28 AM
    SOLVED.

    I have figured this out. Here is the correct code in case anyone else needs it.

    curl -d "json={"devices" : [{"mac" : "'AA:BB:CC:DD:EE:FF'","folderId" : "74ce1675-9b03-4a71-a1ad-213d0fce26b3" }]}" -b Activate-cookie.txt https://activate.arubanetworks.com/api/ext/inventory.json?action=update

    (the change was the addition of the single quotes around the mac address, in addition to the double-quotes)

    This can be put into a batch file, replacing the AA:BB:CC:DD:EE:FF with %1 and then running as:
    batch.cmd aa:bb:cc:dd:ee:ff
    ... you can then run that multiple times with different mac addresses, or use a for loop (for /f) to read a list of mac addresses from a text file, etc.

    Hope this helps someone. Our Ops team are certainly happy they don't have to do this step manually within the Activate Web Portal anymore :)




    ------------------------------
    Roger
    ------------------------------