Developer

last person joined: 2 days ago 

Expand all | Collapse all

How to consume more than 50 Aruba Central API customers

This thread has been viewed 16 times
  • 1.  How to consume more than 50 Aruba Central API customers

    Posted Apr 22, 2021 06:26 PM
    Friends,
    I am consuming the API via python and there is a data limitation in the Aruba request. I've tried pagination, but since I'm not a developer, I've tried to scrape the page with beautiful soap and nothing, then I tried offset / params, and I still have an error.

    I have 125 customers in my company's instance, and I wanted to filter all customers_name / ID.
    Someone to help?



    import requests

    url = "https://apxxxx.arubanetworks.com/msp_api/v1/customers"

    querystring = {"offset":"0","limit":"50"}
    querystring1 = {"offset":"1","limit":"50"}
    querystring2 = {"offset":"2","limit":"50"}


    #headers = {"Accept": "application/json"}
    header = {"authorization": f"Bearer {access_token}"}

    response = requests.get(url, headers=header, params=querystring)
    if response.status_code == 200:
    resp = response.json()
    content_json = resp
    #print(json.dumps(content_json,indent=4))
    customers = content_json['customers']
    for name in customers:
    print(name['customer_name'])
    response1 = requests.get(url, headers=header, params=querystring1)

    OBS: I created several querystring, to help, but I'm not evolving

    ------------------------------
    Jardel Oliveira
    ------------------------------


  • 2.  RE: How to consume more than 50 Aruba Central API customers

    Posted Apr 26, 2021 08:42 AM
    Jardel,

    I think the offset should be 50 if you want to skip the first users. This video may explain how you can do what you are trying.

    ------------------------------
    Herman Robers
    ------------------------
    If you have urgent issues, always contact your Aruba partner, distributor, or Aruba TAC Support. Check https://www.arubanetworks.com/support-services/contact-support/ for how to contact Aruba TAC. Any opinions expressed here are solely my own and not necessarily that of Hewlett Packard Enterprise or Aruba Networks.
    ------------------------------



  • 3.  RE: How to consume more than 50 Aruba Central API customers

    Posted Apr 27, 2021 08:32 AM
    Yea! I watched it, but I think I'm missing something. I will do it again calmly, thank you very much!

    ------------------------------
    Jardel Oliveira
    ------------------------------



  • 4.  RE: How to consume more than 50 Aruba Central API customers

    Posted Apr 27, 2021 08:06 AM
    Yes, We need to increment the offset !

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

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

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

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