Skip to content

Auth Tokens

Operations Summary

Method Endpoint Description
GET /api/auth-tokens/ List Auth Tokens
GET /api/auth-tokens/{user_id}/ Retrieve
DELETE /api/auth-tokens/{user_id}/ Delete

List Auth Tokens

1
2
3
4
http \
  GET \
  https://api.example.com/api/auth-tokens/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.auth_tokens import auth_tokens_list # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = auth_tokens_list.sync(client=client)

for item in response:
    print(item)
  1. API Source: auth_tokens_list
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import { authTokensList } from 'waldur-js-client';

try {
  const response = await authTokensList({
  auth: "Token YOUR_API_TOKEN"
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Description
page integer A page number within the paginated result set.
page_size integer Number of results to return per page.

200 -

The response body is an array of objects, where each object has the following structure:

Field Type Description
url string (uri)
created string (date-time)
user string (uri)
user_first_name string
user_last_name string
user_username string Required. 128 characters or fewer. Lowercase letters, numbers and @/./+/-/_ characters
user_is_active boolean Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
user_token_lifetime integer Token lifetime in seconds.

Retrieve

1
2
3
4
http \
  GET \
  https://api.example.com/api/auth-tokens/123/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.auth_tokens import auth_tokens_retrieve # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = auth_tokens_retrieve.sync(
    user_id=123,
    client=client
)

print(response)
  1. API Source: auth_tokens_retrieve
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { authTokensRetrieve } from 'waldur-js-client';

try {
  const response = await authTokensRetrieve({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "user_id": 123
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
user_id integer

200 -

Field Type Description
url string (uri)
created string (date-time)
user string (uri)
user_first_name string
user_last_name string
user_username string Required. 128 characters or fewer. Lowercase letters, numbers and @/./+/-/_ characters
user_is_active boolean Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
user_token_lifetime integer Token lifetime in seconds.

Delete

1
2
3
4
http \
  DELETE \
  https://api.example.com/api/auth-tokens/123/ \
  Authorization:"Token YOUR_API_TOKEN"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
from waldur_api_client.client import AuthenticatedClient
from waldur_api_client.api.auth_tokens import auth_tokens_destroy # (1)

client = AuthenticatedClient(
    base_url="https://api.example.com", token="YOUR_API_TOKEN"
)
response = auth_tokens_destroy.sync(
    user_id=123,
    client=client
)

print(response)
  1. API Source: auth_tokens_destroy
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
import { authTokensDestroy } from 'waldur-js-client';

try {
  const response = await authTokensDestroy({
  auth: "Token YOUR_API_TOKEN",
  path: {
    "user_id": 123
  }
});
  console.log('Success:', response);
} catch (error) {
  console.error('Error:', error);
}
Name Type Required
user_id integer

204 - No response body