Connect to Suvereo’s API
Once you have the API token of a service account, you can call Suvereo’s API. Programmatic access, such as scripts and other systems, uses a service account. Requests made with a person’s login use a different header, see Signing In and Token Refresh.
Every request carries the token in the Authorization header:
Authorization: Token <API_TOKEN>The service account can only do what its roles allow.
Trying out the API Using Swagger UI
Authorization
- In the main sidebar, click Help → API Documentation. Swagger UI opens in a new tab.
- In Swagger UI, click Authorize in the top-right corner.
- Enter
Token <API_TOKEN>in the authorization field and click Authorize.
You can now interact with the API.
Navigating the Endpoints
Swagger UI lists the endpoints organized by functionality. You can test an endpoint directly from your browser using the Try it out feature.
Example: Retrieving Data Sets with GET /api/data_sets
- Find the
GET /api/data_setsendpoint in the list. - Expand the endpoint by clicking on it.
- Click Try it out.
- Click Execute to send the request.
Using curl
To authenticate with curl, include the API token in the header of each request. Replace <API_TOKEN> with your token and <PATH> with the endpoint path.
-
GET and DELETE requests:
curl -X 'GET' \ 'http://localhost:8000/api/<PATH>' \ -H 'accept: application/json' \ -H 'Authorization: Token <API_TOKEN>' -
POST, PUT and PATCH requests:
curl -X 'POST' \ 'http://localhost:8000/api/<PATH>' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -H 'Authorization: Token <API_TOKEN>' \ -d '{ "key": "value" }'
Example:
curl -X 'GET' \
'http://localhost:8000/api/data_sets' \
-H 'accept: application/json' \
-H 'Authorization: Token <API_TOKEN>'Last updated on