artofrf.com

Ali's Technology Blog

Menu
  • Home
  • Important Links
  • About Me
  • Tools and Scripts
Menu

Aruba Central APIs – Initial Thoughts

Posted on February 14, 2022February 14, 2022 by mali

This post is about my very first experience with Aruba Central APIs. I enjoy working with APIs and automating things to the best of my abilities. After I finally got my Aruba Central account setup; my first step was to figure out how do I get my API token.

After logging into Aruba Central, under Global Settings, API Gateway is where you can get your token.

Aruba Central – Global Settings
Aruba Central – My Apps & Tokens

After clicking Generate I had a Token available under Token List.

Aruba Central – Generate new Token

You can easily download the generated token from here:

Aruba Central – Token List

I recommend saving the Client ID and Client Secret from under “My Apps and Tokens”. This will be needed later so that the token can be refreshed.

Aruba Central – My Apps & Tokens

Downloaded Token looks something like this:

{
  "access_token": "S46iW64E2Ef83ra.......",###TOKEN
  "appname": "nms",
  "authenticated_userid": "youremail@yourdomain.com",
  "created_at": 1644633736495,
  "credential_id": "xxxxxxxx....",###What is this - Pending???
  "expires_in": 7200,
  "id": "34c37278-xxxx-xxxx-........", ###TOKEN ID
  ###This token is used to refresh the token instead of creating a new 
  one###
  "refresh_token": "Qjexxxxxxxxxxx",
  "scope": "all",
  "token_type": "bearer"
}

Following link goes over “Making API Calls” in detail; following two are key components of the API call:

Content-Type: application/json
Authorization: Bearer "Token"

There are three different sections of the API URL:

  1. Domain Name – See this link – These have to be specific to your login
  2. Endpoint path – Under API Gateway -> All Published APIs
  3. Query parameters – If any specific query parameters are required

Refreshing Token:

While I was reading up on all this, figuring out how to get it formatted in my IDE; my token expired (lasts for 2 hours). Instead of creating a new one, I decided to refresh my existing token.

Here is a short newbie script to refresh Aruba Centrals’ API Token:

import requests
from pprint import pprint as pp
#### This script will referesh the token after 2 hours
client_id = 'xxxxxxxxx'
client_secret = 'xxxxxxxxxxxxx'
grant_type = 'refresh_token&'
### There is a new refresh token each time token gets refreshed
refresh_token = 'yyyyyyyyyyyyyyyyyy'
base_url = 'https://......'
### URL NOTES ###
### Domain Name: This is the domain name of the API gateway based on the location of the Aruba Central Customer account
### https://developer.arubanetworks.com/aruba-central/docs/api-oauth-access-token#section-requirements
### API Endpoint Path: Endpoint path is the path within the API Gateway domain.
### https://developer.arubanetworks.com/aruba-central/reference/apiget_idp_metadata

url = base_url +'/oauth2/token?client_id='+ client_id + 'client_secret='\
+ client_secret +'grant_type='+ grant_type +'refresh_token='+ refresh_token
#print(url)
headers = {
  'Content-Type': 'application/json',
}
response = requests.post(url, headers=headers)
data = response.json()
pp(data)

My First API Call:

Time to make my first API call. I decided to run a simple query to see my access point.

Aruba Central – API Reference

If you pay attention you will notice, “List Access Points” and “List BSSID’s” twice. Difference is versions. First one is v1, second one is v2:

Aruba Central – List Access Points v1
Aruba Central – List Access Points v2

Again my short newbie Aruba Central API script:

import requests
from pprint import pprint as pp
###NOTE: This can be setup as an environment variable, I just haven't done that yet.
aruba_apikey = 'Bearer your-token-goes-here'
base_url = 'https://apigw-uswest4.central.arubanetworks.com'

url = base_url + '/monitoring/v2/aps'
print(url)
headers = {
    'Content-Type': 'application/json',
    'Authorization': aruba_apikey
}
response = requests.get(url, headers=headers)
data = response.json()
pp(data)

API Reponse:

{'aps': [{'ap_deployment_mode': 'IAP',
          'ap_group': None,
          'cluster_id': '',
          'controller_name': '',
          'firmware_version': '8.7.1.0_77203',
          'gateway_cluster_id': '',
          'gateway_cluster_name': '',
          'group_name': 'default',
          'ip_address': '192.168.10.115',
          'labels': [],
          'last_modified': 1644287715,
          'macaddr': 'f4:xxxxxx',
          'mesh_role': 'Unknown',
          'model': '515',
          'name': 'f4:xxxxx',
          'notes': None,
          'public_ip_address': '#.#.#.#',
          'radios': [{'band': 1,
                      'index': 0,
                      'macaddr': 'f4:xxxxxx',
                      'radio_name': 'RADIO 5 GHz',
                      'radio_type': '802.11ax',
                      'spatial_stream': '4x4:4',
                      'status': 'Down'},
                     {'band': 0,
                      'index': 1,
                      'macaddr': 'f4:xxxxxxxx',
                      'radio_name': 'RADIO 2.4 GHz',
                      'radio_type': '802.11ax',
                      'spatial_stream': '2x2:2',
                      'status': 'Up'}],
          'serial': 'CAAAAAAAAA',
          'site': None,
          'status': 'Up',
          'subnet_mask': '255.255.255.0',
          ###Don't know what this is exactly###
          'swarm_id': '111111222222ssssssssss',
          'swarm_master': True,
          'swarm_name': 'SetMeUp-xxxx'}],
 'count': 1}

Pretty usual stuff that can easily be filtered/manipulated.

Summary:

Setting up token and initial access was easy and straightforward and there was good documentation available to get you going. This link is a good starter link. I found following few things that I feel can be improved and can be counter productive.

  • 1000 API Calls per day/per org (If you need more you have to ask Aruba to increase them. Don’t know the max number).
  • There are different versions, if you have a large system built utilizing Aruba API’s and Aruba changes the version; this can increase R&D work.
  • You have to use a specific URL for the cloud server you are on, just like logging in. I tried using the generic URL I saw in one example and that did not work.
  • You have to refresh the token ever two hours.

There is much more to be explored in this realm of Aruba Central, I will post my experiences as I learn more.

Category: Aruba, Aruba, Aruba Central

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • Nile Secure Guest – Configuration and Use Case
  • WLAN Pros Toolbox
  • Nile does NAC – Configuring Trust Engine
  • WLAN Validator
  • PCAP I/O Graph Analyzer

Tags

AirDrop arista Arista AGNI Arista CV-CUE Arista NAC Arista WIPS Arista WPA3 UPSK Aruba Central Automating Mist Switch Templates Automation AWDL Configuring Switch Templates in Mist CWAP 403 EAP Format MAC Addresses Hamina Network Planner Juniper SRX300 MacBook Marvis mdns MFD8 MFD9 Mist Access Assurance MistAI Mist Auto Placement Mist MPSK Mist Wireless NaaS Networking Field Day NFD32 NileNav Nile Secure Nile Wi-Fi Social Channels Tech Field Day Troubleshooting with Marvis Troubleshooting with Mist Troubleshooting with Mist AI Troubleshooting with Wireshark Wireless Adjuster Wireless Adjuster Level II Wireless troubleshooting WLPC wlpc2023 Wyebot

Tech Blogs

  • WiFiTodd
  • CCNA Wireless
  • Cisco Full Bars
  • Packet Life
  • Havilandweb
  • Gjermund Raaen
  • Bad-Fi
  • The ASCII Construct
  • Juniper Port Checker
  • WiFrizzy
  • Spectrum Chart
  • BadgerWiFi

Recent Comments

  • Hiten Thakkar on PCAP I/O Graph Analyzer
  • mali on Deploying Nile Secure – My First NSB
  • Larry Farrish on Deploying Nile Secure – My First NSB
  • Courtney on Mist Access Point – CSV
  • ayoub chabrouk on Ubiquiti stealing the show at MFD11

Archives

  • August 2026
  • July 2026
  • March 2026
  • February 2026
  • December 2025
  • November 2025
  • October 2025
  • August 2025
  • May 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • May 2024
  • April 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • September 2023
  • August 2023
  • June 2023
  • May 2023
  • April 2023
  • February 2023
  • November 2022
  • October 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • May 2021
  • April 2021
  • March 2021
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • April 2019
  • March 2019
  • November 2018
  • October 2018
  • September 2018
  • May 2018
  • January 2018
  • December 2017
  • August 2017
  • January 2017
  • September 2014
  • December 2013
  • October 2013
  • May 2013
  • August 2012
  • July 2012

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Categories

  • AeroHive
  • Arista
  • Arista
  • Aruba
  • Aruba
  • Aruba Central
  • BYoD
  • Certifications
  • Cisco
  • Cisco
  • Cisco EEM Scripting
  • Cisco Routing
  • Cisco Security
  • Cisco VoIP
  • Cisco VPN
  • Cisco Wireless
  • Conferences and Meetings
  • Design
  • Ekahau
  • General
  • Hamina
  • IoT, IIoT, OT
  • Juniper Security
  • Juniper Switching
  • Juniper/Mist
  • Linux
  • Microsoft
  • Mist
  • Mist Wireless
  • Nile
  • Nile Secure
  • Nile Wi-Fi
  • Programming/Automation
  • Python
  • Ruckus
  • Ruckus Wireless
  • Ruckus/Brocade
  • Ruckus/Brocade Scripting
  • Ruckus/Brocade Switching
  • Secure Guest Service
  • Security
  • Switching
  • Tools
  • Troubleshooting
  • Trust Engine
  • Uncategorized
  • Windows
  • Wireless
  • Wireless
  • WLAN Tools
© 2026 artofrf.com | Powered by Minimalist Blog WordPress Theme