API Tokens

Generate an API Token

This endpoint returns a newly generated API Token. If the user already has a token, it will be regenerated.

Note: This endpoint uses basic authentication, and can only be run by the user to create their own token. It can't be used to change other users' tokens.

POST /api/v2/users/{user_id}/api-token/

URL Parameters

Parameter Description
user_id The ID of the User to retrieve
POST /api/v2/users/{user_id}/api-token/ HTTP/1.1
Accept: application/json
Authorization: Basic "YOUR BASE64 ENCODING OF USERNAME:PASSWORD"
Cookie: sessionid="YOUR SESSION ID"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "token": "1234567890abcdefghijklmnopqrstuvwxyz",
    "connection_string": "1234567890abcdefghijklmnopqrstuvwxyz@example.com"
}

Regenerate an API Token

This endpoint revokes and then regenerates an API Token.

Note: This endpoint only uses either basic or session authentication.

PATCH /api/v2/users/{user_id}/api-token/

URL Parameters

Parameter Description
user_id The ID of the User to retrieve
PATCH /api/v2/users/{user_id}/api-token/ HTTP/1.1
Accept: application/json
Authorization: Basic "YOUR BASE64 ENCODING OF USERNAME:PASSWORD"
Cookie: sessionid="YOUR SESSION ID"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "token": "1234567890abcdefghijklmnopqrstuvwxyz",
    "connection_string": "1234567890abcdefghijklmnopqrstuvwxyz@example.com"
}

Get an API Token

This endpoint retrieves the users API Token. For security reasons the token will be obfuscated. If you have lost your token you will have to regenerate it.

Note: This endpoint only uses either basic or session authentication.

GET /api/v2/users/{user_id}/api-token/

URL Parameters

Parameter Description
user_id The ID of the User to retrieve
GET /api/v2/users/{user_id}/api-token/ HTTP/1.1
Accept: application/json
Authorization: Basic "YOUR BASE64 ENCODING OF USERNAME:PASSWORD"
Cookie: sessionid="YOUR SESSION ID"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "token": "***********************************vwxyz",
    "connection_string": "***********************************vwxyz@example.com"
}

Revoke an API Token

This endpoint revokes the users current API Token. Only admin users can revoke API Tokens of other users.

Note: This endpoint only uses either basic or session authentication.

DELETE /api/v2/users/{user_id}/api-token/

URL Parameters

Parameter Description
user_id The ID of the User to retrieve
DELETE /api/v2/users/{user_id}/api-token/ HTTP/1.1
Accept: application/json
Authorization: Basic "YOUR BASE64 ENCODING OF USERNAME:PASSWORD"
Cookie: sessionid="YOUR SESSION ID"
HTTP/1.1 204 NO CONTENT

results matching ""

    No results matching ""