Token operations in the Credentials API
Example
This bash
script will generate tokens for different APIs.
#!/bin/bash
token="your 32 character hexadecimal token"
base_url="https://api-your_region.devo.com"
domain="your_devo_domain"
user="user@example.com"
curl -i -H "Authorization: Bearer $token" -H 'Content-Type: application/json' -X POST "$base_url/ws/accounts/$domain/credentials/tokens" --data '
{
"name": "Aggregation task token created by API",
"user": "'"$user"'",
"audience": "aggregations",
"scopes": "table://my.app.test.tokenapi level://admin"
}'
curl -i -H "Authorization: Bearer $token" -H 'Content-Type: application/json' -X POST "$base_url/ws/accounts/$domain/credentials/tokens" --data '
{
"name": "Query token created by API",
"user": "'"$user"'",
"audience": "apiv2",
"scopes": "table://my.app.test.tokenapi level://admin"
}'
curl -i -H "Authorization: Bearer $token" -H 'Content-Type: application/json' -X POST "$base_url/ws/accounts/$domain/credentials/tokens" --data '
{
"name": "Query job management token created by API",
"user": "'"$user"'",
"audience": "apiv2-admin",
"scopes": "table://my.app.test.tokenapi level://admin"
}'
curl -i -H "Authorization: Bearer $token" -H 'Content-Type: application/json' -X POST "$base_url/ws/accounts/$domain/credentials/tokens" --data '
{
"name": "Alerts token created by API",
"user": "'"$user"'",
"audience": "alerts",
"scopes": "table://my.app.test.tokenapi level://admin"
}'
curl -i -H "Authorization: Bearer $token" -H 'Content-Type: application/json' -X POST "$base_url/ws/accounts/$domain/credentials/tokens" --data '
{
"name": "HTTP ingestion token created by API",
"user": "'"$user"'",
"audience": "http",
"scopes": "table://my.app.test.tokenapi level://admin"
}'
curl -i -H "Authorization: Bearer $token" -H 'Content-Type: application/json' -X POST "$base_url/ws/accounts/$domain/credentials/tokens" --data '
{
"name": "HTTP ingestion token for all tables created by API",
"user": "'"$user"'",
"audience": "http",
"scopes": "table://*.** level://admin"
}'
Once the new tokens are created, they will appear in the Devo web app, along side the token used as input.
Endpoints and methods
{accountName}
refers to the Devo domain name. If the domain name is child@parent
, do not use child
.
Endpoints and methods | Description |
---|---|
POST | Creates a new token. |
GET | Returns a list of all the tokens for the provided account. |
GET | Returns all the information of a single token, including the token itself. |
PUT | Enables a token. |
PUT | Disables a token. |
PUT | Changes the name associated with a token. |
DELETE | Deletes a token. |
POST /ws/accounts/{accountName}/credentials/tokens
Creates a new token. See permissions.
GET /ws/accounts/{accountName}/credentials/tokens
Lists all the tokens for the provided account. This endpoint returns information about the tokens and their IDs but does not include the token values for security reasons.
Expired tokens will be returned with the active
parameter set as false
.
GET /ws/accounts/{accountName}/credentials/tokens/{tokenId}
Returns full details of a single token identified by its ID. The response to this request includes the actual token value.
Expired tokens will be returned with the active
parameter set as false
.
PUT /ws/accounts/{accountName}/credentials/tokens/{tokenId}/enable
Enable token by ID.
PUT /ws/accounts/{accountName}/credentials/tokens/{tokenId}/disable
Disable token by ID.
PUT /ws/accounts/{accountName}/credentials/tokens/{tokenId}/rename
This endpoint updates the name associated with a token, identified by its ID.
DELETE /ws/accounts/{accountName}/credentials/tokens/{tokenId}
Deletes a token from an account.
Only to be used when the token is to be removed from the service. There is no coming back from this, and once a token is deleted then it's gone for good.