Making API calls
Making API calls simply means sending HTTP requests to HPE Aruba Networking Central. The standard HTTP request typically contains headers, cookies, API endpoint URL, method and body.
HTTP Request Requirements
Request Headers
Access Token should be provided in 'Authorization' header while making API calls. It is through this token, access to API endpoints are provided. Steps to obtain access token are provided in the previous sections.
'Content-Type' should be 'application/json' when the API request has JSON data. Otherwise, it should not be provided.
Key | Value |
---|---|
Authorization | Bearer <access_token> |
Content-Type | application/json |
Accessing Tenant APIs using MSP Access Token
MSP users can use an MSP-level access token to perform API operations on their tenants. Therefore, it becomes easier to manage multiple tenants using API, present under the MSP account. User privileges as per the tenant role are applied for these operations. An MSP user must provide the tenant Customer ID as part of the request header.
Key | Value |
---|---|
TenantID | <Tenant_Customer_ID> |
Request Method
One of the available methods (GET, POST, PUT, PATCH, DELETE) as described in Getting Started with REST API section.
API Endpoint URL
The resources/services offered by an API is accessed via its URL. Each API endpoint will have its own unique URL. URL contains multiple components such as base path, API endpoint path and query parameters. These components together form HTTP Request URL.
- Domain Name: This is the domain name of the API gateway based on the location of the HPE Aruba Networking Central Customer account. A table of domain URLs based on location can be found in the previous section. It can also be obtained from HPE Aruba Networking Central Account Home -> API Gateway -> APIs -> Published APIs Table.
- API Endpoint Path: Endpoint path is the path within the API Gateway domain. This path represents the REST API endpoint through which HTTP requests are made. This can be obtained from the API reference page.
Note
Part of the API endpoint path is version number. It might vary for different HTTP methods of same API endpoint resource object. It is represented as v1 / v2 / v3 and so on. Older versions are usually mentioned as deprecated in the API reference page.
- Query Parameters: Some API endpoints might require query parameters. For example, GET method of /configuration/v2/groups API endpoint accepts the following query parameters.
HTTP payload
Data in JSON format as required by the API endpoint. Each API endpoint accepts a pre-defined structure of key and value pairs. The following is an example of payload structure required by API endpoint /configuration/v2/groups with POST method.
{
"group_attributes": {
"template_info": {
"Wired": true
},
"group_password": "demo@123"
},
"group": "demo-auto-grp"
}
Example HTTP Requests
HTTP GET: List groups
API Endpoint URL: https://apigw.central.arubanetworks.com/configuration/v2/groups?limit=5&offset=0
Request Headers:
'Content-Type': 'application/json'; 'Authorization': 'Bearer <access-token>'
Request Method: GET
HTTP Response: Response for Status Code 200
{
"data": [
[
"Central#1"
],
[
"Central#2"
],
[
"Central#3"
],
[
"QuebecCity-Branch"
],
[
"Aruba-SD-BRANCH"
],
],
"total": 65
}
HTTP POST: Create a new group
API Endpoint URL: https://apigw.central.arubanetworks.com/configuration/v2/groups
Request Headers:
'Content-Type': 'application/json'; 'Authorization': 'Bearer <access-token>'
Request Method: POST
Request Payload: "test-auto-grp" is the name of the group
{
"group_attributes": {
"template_info": {
"Wired": true
https://dash.readme.io/project/aruba-central/v1.0/docs/http-request },
"group_password": "demo@123"
},
"group": "test-auto-grp"
}
HTTP Response: Response for Status Code 201
"Created"
Note
PATCH, PUT and DELETE methods takes action on existing resources. Therefore, they might require the resource identifier in API endpoint URL. Resource identifier could be name or ID of an entity.
HTTP PATCH: Update existing group password
API Endpoint URL: https://apigw.central.arubanetworks.com/configuration/v1/groups/test-auto-grp
where "test-auto-grp" is the name of the group
Request Headers:
'Content-Type': 'application/json'; 'Authorization': 'Bearer <access-token>'
Request Method: PATCH
Request Payload:
{
"group_password": "demo@xyz"
}
HTTP Response: Response for Status Code 200
"Success"
HTTP DELETE: Delete existing group
API Endpoint URL: https://apigw.central.arubanetworks.com/configuration/v1/groups/test-auto-grp
where "test-auto-grp" is the name of the group
Request Headers:
'Content-Type': 'application/json'; 'Authorization': 'Bearer <access-token>'
Request Method: DELETE
HTTP Response: Response for Status Code 200
"Success"
Updated 4 months ago