Objective
This article explains how to obtain credentials to access the API, log in, and query information.
Obtaining credentials
The API can be access using the username and password of all normal user accounts. This will give access to the same information as is available through the user interface.
Dedicated API user accounts are also available. The advantage of this is that:
- These accounts do not show up in the list of users
- In audit logs, write operations show up in audit logs as being performed by an API user, instead of a normal user. The latter could cause confusion and incorrect attribution of responsibility.
To obtain an API user account, please contact the helpdesk.
Obtaining an API access token
The introduction section of the API documentation provides information about how to log in: https://www.fireservicerota.co.uk/apidocs/. We support the OAuth2 protocol using the password grant.
curl -F grant_type=password \
-F username=[username] \
-F password=[password] \
-X POST https://www.fireservicerota.co.uk/oauth/token
{
"access_token":"[token]",
"token_type":"Bearer",
"expires_in":1209600,
"refresh_token":"[refresh_token]",
"created_at":1616180000
}
Accessing API endpoints
To read or write to the API, the token obtained in the previous step must be provided in the Authorization HTTP header. See https://www.fireservicerota.co.uk/apidocs/ for more details and examples.
curl "https://www.fireservicerota.co.uk/api/v2/[api_path]" \
-H "accept: application/json" \
-H "Authorization: Bearer [token]"
Comments
0 comments
Please sign in to leave a comment.