const apiInstance = new Fastly.TokensApi();
Note
All URIs are relative to https://api.fastly.com
Method | HTTP request | Description |
---|---|---|
bulkRevokeTokens | DELETE /tokens | Revoke multiple tokens |
createToken | POST /tokens | Create a token |
getToken | GET /tokens/{token_id} | Get a token |
getTokenCurrent | GET /tokens/self | Get the current token |
listTokensCustomer | GET /customer/{customer_id}/tokens | List tokens for a customer |
listTokensUser | GET /tokens | List tokens for the authenticated user |
revokeToken | DELETE /tokens/{token_id} | Revoke a token |
revokeTokenCurrent | DELETE /tokens/self | Revoke the current token |
bulkRevokeTokens({ , [request_body] })
Revoke Tokens in bulk format. Users may only revoke their own tokens. Superusers may revoke tokens of others.
const options = {
request_body: {"data":[{"id":"3krg2uUGZzb2W9Euo4moOY","type":"token"},{"id":"71ZA6hv2FO6tGEQIE203Xj","type":"token"}]},
};
apiInstance.bulkRevokeTokens(options)
.then(() => {
console.log('API called successfully.');
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
request_body | {String: Object} | [optional] |
null (empty response body)
createToken()
Create an API token. If two-factor authentication is enabled for your account, review the instructions for including a one-time password in the request.
apiInstance.createToken()
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
This endpoint does not need any parameters.
getToken({ token_id })
Get a single token by its id.
const options = {
token_id: "token_id_example", // required
};
apiInstance.getToken(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
token_id | String | Alphanumeric string identifying a token. |
getTokenCurrent()
Get a single token based on the access_token used in the request.
apiInstance.getTokenCurrent()
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
This endpoint does not need any parameters.
listTokensCustomer({ customer_id })
List all tokens belonging to a specific customer.
const options = {
customer_id: "customer_id_example", // required
};
apiInstance.listTokensCustomer(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
customer_id | String | Alphanumeric string identifying the customer. |
listTokensUser()
List all tokens belonging to the authenticated user.
apiInstance.listTokensUser()
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
This endpoint does not need any parameters.
revokeToken({ token_id })
Revoke a specific token by its id.
const options = {
token_id: "token_id_example", // required
};
apiInstance.revokeToken(options)
.then(() => {
console.log('API called successfully.');
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
token_id | String | Alphanumeric string identifying a token. |
null (empty response body)
revokeTokenCurrent()
Revoke a token that is used to authenticate the request.
apiInstance.revokeTokenCurrent()
.then(() => {
console.log('API called successfully.');
})
.catch((error) => {
console.error(error);
});
This endpoint does not need any parameters.
null (empty response body)