Accessing the API Documentation
Navigate to your SELMA Settings and down to API at the bottom or go to https://subdomain.selmasis.com/api/docs
to view the API docs
You can try out and view responses for the various endpoints on this page, but first you must become ‘Authorised’.
Authentication
- Make a request to retrieve a ‘token’ from
https://subdomain.selmasis.com/auth
- curl:
curl --location --request POST 'https://subdomain.selmasis.com/auth' --header 'Authorization: Basic' --header 'Content-Type: application/json' --data-raw '{"email":"email@example.com","password":"password123"}'
- HTTP/REST
POST https://subdomain.selmasis.com/auth Authorization: Basic Content-Type: application/json {"email":"email@example.com","password":"password123"}
- curl:
- The token will be returned as a response.
- Add the token to the field when you click on the ‘Authorize’ button at the top of the
/docs
page. Remember to add “Bearer ” in front of the token (eg “Bearer eyJ0eXAiOiJKV1QiLCJhbGci...
“)
You should be able to make requests on this page now.
Requests
To use the bearer token in API requests outside of the docs page make sure to add the bearer token to the header in all requests, these tokens are valid for 30 minutes.
curl:
curl --location 'https://subdomain.selmasis.com/api/example' \ --header 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1....'
HTTP/REST:
GET /api/exmaple HTTP/1.1 Host: subdomain.selmasis.com Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGc…