This article will walk you through the steps to get authenticated with the Air Maestro API, either through user or API Key authentication. Subsequent requests can be made to the API once authenticated, using the generated bearer token.
All Air Maestro users have access to the Air Maestro API with respect to their access levels.
To get an API Key, you will first need to create a Service Account. See Creating Service Accounts and Generating API Keys
Using Finder Service
To get the URL for the API for a specific client you will need to use the Finder Service.
The finder service endpoint will return the API URL (webServiceURL) and the site key (site_key). The site key is used to identify which client is requesting as the API is multi-tenanted.
- Go to the Finder Service URL: https://finderv2.airmaestro.net/ (Swagger UI is available)
- Send a request to the Finder Service endpoint using the client site URL
Example request:curl -X GET --header 'Accept: application/json' 'https://finderv2.airmaestro.net/api/Finder/getSiteDetails?siteURL=test.airmaestro.com.au'
The API URL will change with each version update of the client’s Air Maestro site.
Always make a request to the Finder Service before making any other API requests, to ensure you're sending them to the correct location.
Authenticating with the API
Once you have the API URL and site key, you need to authenticate your requests.
To authenticate, use the token endpoint. This will generate a bearer token that can be passed into other
requests for authentication.
Generating a Bearer Token
Request Parameters
grant_type | Always "password" |
site_key | The site key obtained from the Finder Service |
username |
An Air Maestro user username |
password |
An Air Maestro user password |
key_name | The name of an API Key (mutually exclusive with user authentication) |
api_key | An API Key (mutually exclusive with user authentication) |
client_id |
Indicates which "device" is authenticating |
saml_uuid | Not for integrators to use |
saml_response | Not for integrators to use |
refresh_token | Not for integrators to use |
Example request:
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' -d 'grant_type=password&site_key=am_test&username=test&password=test&client_id=pwaapp' 'https://workerdev.airmaestro.com.au/1.1.1/token'
Comments
0 comments
Please sign in to leave a comment.