Details on the various actions that can be performed on the
User Api Tokens resource, including the expected
parameters and the potential responses.
Returns the API tokens for a user
var params = {}; // all params are optional
// with callbacks
client.userApiTokens.get(params, function (err, result) {
if (err) { return console.error(err); }
console.log(result);
});
// with promises
client.userApiTokens.get(params)
.then(console.log)
.catch(console.error);
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.User, all.User.read, userApiTokens.*, or userApiTokens.get.
Name |
Type |
Required |
Description |
Default |
Example |
sortField |
string |
N |
Field to sort the results by. Accepted values are: name, status, id, creationDate, lastUpdated, expirationDate |
name |
name |
sortDirection |
string |
N |
Direction to sort the results by. Accepted values are: asc, desc |
asc |
asc |
page |
string |
N |
Which page of results to return |
0 |
0 |
perPage |
string |
N |
How many items to return per page |
100 |
10 |
filterField |
string |
N |
Field to filter the results by. Blank or not provided means no filtering. Accepted values are: name, status |
|
key |
filter |
string |
N |
Filter to apply against the filtered field. Supports globbing. Blank or not provided means no filtering. |
|
my*token |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
200 |
API Token |
Collection of API tokens |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |
Create a new API token for an user
var params = {
apiToken: myApiToken
};
// with callbacks
client.userApiTokens.post(params, function (err, result) {
if (err) { return console.error(err); }
console.log(result);
});
// with promises
client.userApiTokens.post(params)
.then(console.log)
.catch(console.error);
The client must be configured with a valid api access token to call this
action. The token must include at least one of the following scopes:
all.User, userApiTokens.*, or userApiTokens.post.
Name |
Type |
Required |
Description |
Default |
Example |
apiToken |
API Token Post |
Y |
API token information |
|
API Token Post Example |
losantdomain |
string |
N |
Domain scope of request (rarely needed) |
|
example.com |
Code |
Type |
Description |
201 |
API Token |
The successfully created API token |
Code |
Type |
Description |
400 |
Error |
Error if malformed request |