Central

The Central Developer Hub

Welcome to the Central developer hub. You'll find guides and documentation to help you start working with Central APIs as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

REST API Workflows

Leveraging automation, can save time and cost to implement workflows that are done manually.

API endpoints for some of the workflows mentioned in the Use Cases section are provided below.

Update AP settings / Rename an AP

Often there is a need to rename multiple APs managed by Aruba Central. This is the endpoint to rename one AP. In order to rename multiple APs, multiple calls to this API endpoint has to be made. This API can also be used to update other AP settings as shown in the payload.

API Endpoint Path: /configuration/v2/ap_settings/{serial_number}
where serial_number is the serial number of the IAP.
Request Method: POST
Request Headers: "Authorization": "Bearer <access_token>"
Request Payload:

{
  "hostname": "<ap-name>",
  "ip_address": "<ip-address>",
  "zonename": "<zone-name>",
  "achannel": "<achannel-num>",
  "atxpower": "<atxpower-num>",
  "gchannel": "<gchannel-num>",
  "gtxpower": "<gtxpower-num>",
  "dot11a_radio_disable": <true/false>,
  "dot11g_radio_disable": <true/false>,
  "usb_port_disable": <true/false>
}

Python Example

In this workflow, using pycentral.workflows.config_apsettings_from_csv module from Python SDK pycentral we choose to update the following settings for multiple APs defined in a CSV file.

  • serial_number, hostname, ip_address, zonename,
    achannel, atxpower, gchannel, gtxpower,
    dot11a_radio_disable, dot11g_radio_disable, usb_port_disable

If any of the settings need not be updated, leave it blank in CSV file. In the following CSV file, we would only change the hostname of the APs.

serial_number,hostname,ip_address,zonename,achannel,atxpower,gchannel,gtxpower,dot11a_radio_disable,dot11g_radio_disable,usb_port_disable
CNAAAA1234,AP1,,,,,,,,,
CNBBBB1234,AP2,,,,,,,,,

At the end of script execution, a list of APs that the script failed to update will be listed for troubleshooting.

# Create the following files by refering to the samples.
csv_filename = "csv_file.csv"
central_filename = "input_token_only.yaml"

# Get instance of ArubaCentralBase from the central_filename
from pycentral.workflows.workflows_utils import get_conn_from_file
central = get_conn_from_file(filename=central_filename)

# Rename AP using the workflow `workflows.config_apsettings_from_csv.py`
from pycentral.workflows.config_apsettings_from_csv import ApSettingsCsv
ApSettingsCsv(conn=central, csv_filename=csv_filename)

Note on API Usage Limit

Please note that the AP settings workflow uses (2 * N) number of API calls. Where N is the number of APs in the CSV file. For each AP, GET method is used to obtain existing AP settings and then a POST method is used to update the existing settings.

Site Deployment Workflow

In this workflow let's do the following

  • Create a Group
  • Move devices to the created Group
  • Create a Site
  • Assign devices to the created Site

Create a Site:

API Endpoint Path: /central/v2/sites
Request Method: POST
Request Headers: "Authorization": "Bearer <access_token>"
Request Payload:

{
  "site_name": "site1",
  "site_address": {
    "address": "3970 Rivermark Plaza",
    "city": "Santa Clara",
    "state": "California",
    "country": "United States",
    "zipcode": "95053"
  },
  "geolocation": {
    "latitude": "38.8951",
    "longitude": "-77.0364"
  }
}

HTTP Response: For successful request, site_id will be returned for created site

{
  "site_id": 9,
  "site_name": "site1"
}

Create a Group:

API Endpoint Path: /configuration/v2/groups
Request Method: POST
Request Headers: "Authorization": "Bearer <access_token>"
Request Payload: Setting true for Wired, Wireless keys will make the group a template group.

{
  "group": "Central_Group",
  "group_attributes": {
    "group_password": "[email protected]",
    "template_info": {
      "Wired": true,
      "Wireless": true
    }
  }
}

HTTP Response: For successful request

"Created"

Assign device to a Site:

API Endpoint Path: /central/v2/sites/associate
Request Method: POST
Request Headers: "Authorization": "Bearer <access_token>"
Request Payload:

{
  "device_id": "AD12412345",
  "device_type": "IAP",
  "site_id": 4
}

HTTP Response: No response message will be received for successful HTTP request.

Move devices to a Group:

This API endpoint moves a list of devices to a group. The devices are represented as serial numbers.

API Endpoint Path: /configuration/v1/devices/move
Request Method: POST
Request Headers: "Authorization": "Bearer <access_token>"
Request Payload:

{
  "group": "Central_Group",
  "serials": [
    "string"
  ]
}

HTTP Response: For successful request

"Success"

Python Example

Python script developed using pycentral Python SDK for site deployment workflow.

# Create the following files by refering to the samples.
csv_filename = "csv_file.csv"
central_filename = "input_token_only.yaml"

# Get instance of ArubaCentralBase from the central_filename
from pycentral.workflows.workflows_utils import get_conn_from_file
central = get_conn_from_file(filename=central_filename)

# Import Groups and Sites class
from pycentral.configuration import Groups, Devices
from pycentral.monitoring import Sites
g = Groups()
s = Sites()
d = Devices()

# Define Workflow Variables
group_name = "demo-grp"
group_pass = "[email protected]"
site_name = "demo-site"
site_address = {
  "address": "3000 Rivermark Plaza",
  "city": "Santa Clara",
  "state": "California",
  "country": "United States",
  "zipcode": "95053"
}
device_type = "IAP"
device_serials = ["CNXXXXXX01", "CNXXXXXX02", "CNXXXXXX03"]

# 1. Create a Template Group
print("1. Create a Group")
resp = g.create_group(central, group_name=group_name, group_password=group_pass, 
                      wired_template=True, wireless_template=True)
print(resp)

# 2. Move devices to a Group
print("2. Move devices to a Group")
resp = d.move_devices(central, group_name=group_name,
                      device_serials=device_serials)
print(resp)  
    
# 3. Create a Site
print("3. Creating Site")
resp = s.create_site(central, site_name=site_name, site_address=site_address)
print(resp)

# 4.1 Find site_id from site_name
site_id = s.find_site_id(central, site_name=site_name)

# 4.2 Assign Devices
print("4. Assign Devices to a Site")
resp = s.associate_devices(central, site_id=site_id, 
                           device_type=device_type, device_id=device_serials)
print(resp)



Updated 4 months ago


REST API Workflows


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.