Authentication
Currently we provide one way to authenticate users using a token.
Token Authentication
Vouchers uses API keys to allow access to the API. You can get the key with your crendentials
in the following endpoint: /api-token-auth/
with the parameters username
and password
.
Example using bash
First define your credentials:
USERNAME=...
PASSWORD=...
Now you can fetch your token, you can call the api-token-auth
endpoint with a body of the form:
JSON_STRING=$( jq -n \
--arg u "$USERNAME" \
--arg p "$PASSWORD" \
'{username: $u, password: $p}' )
curl 'https://bonkdo.com/api-token-auth/' \
-H 'Content-Type: application/json; charset=UTF-8' \
--data-binary "$JSON_STRING"
you will get the token in an output with the form:
{
...
"token": "the_token_goes_here_and_you_have_to_use"
...
}
Define the token in your shell:
API_KEY=the_token_goes_here_and_you_have_to_use
Vouchers expects for the API key to be included in all API requests to the server in the Authorization
header
You can check your API_KEY
running:
curl "https://bonkdo.com/api/vouchers/"
-H "Authorization: Token $API_KEY"
In this documentation we are using example endpoints calls that are authentication agnostic in order to make the examples more concise. Any of the mentioned authentication mechanisms can be used.