REST API Authentication¶
The API documented here uses token-based authentication over SSL (https://).
In order to receive an access token a POST request like the following must be made:
-
POST
/api/v1/auth-token/
¶ Synopsis: Gets the acces token for the user especified in the request content body. Example request:
POST /api/v1/auth-token/ HTTP/1.1 Host: localhost:8000 Accept: application/json { "username": "bob", "password": "bob-pass" }
Example response:
HTTP/1.1 200 OK Allow: POST, OPTIONS Content-Type: application/json { "token": "1612a857a43c21d688ccbe849dbfbf078cef8cc7" }
Request Headers: - Accept – application/json
Request JSON Object: - username (string) – the authenticating user’s username
- password (string) – the authenticating user’s password
Response Headers: - Content-Type – application/json
Response JSON Object: - token (string) – access token for future authentications
Status Codes: - 200 OK – no error
- 400 Bad Request – unable to log in with provided credentials