This article explains how to obtain credentials to access the API, log in, and query information.
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
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]"
Please sign in to leave a comment.