Skip to content

Latest commit

 

History

History
332 lines (226 loc) · 9.21 KB

AccessTokensApi.md

File metadata and controls

332 lines (226 loc) · 9.21 KB

LaunchDarklyApi.AccessTokensApi

All URIs are relative to https://app.launchdarkly.com

Method HTTP request Description
deleteToken DELETE /api/v2/tokens/{id} Delete access token
getToken GET /api/v2/tokens/{id} Get access token
getTokens GET /api/v2/tokens List access tokens
patchToken PATCH /api/v2/tokens/{id} Patch access token
postToken POST /api/v2/tokens Create access token
resetToken POST /api/v2/tokens/{id}/reset Reset access token

deleteToken

deleteToken(id)

Delete access token

Delete an access token by ID.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.AccessTokensApi();
let id = "id_example"; // String | The ID of the access token to update
apiInstance.deleteToken(id, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
id String The ID of the access token to update

Return type

null (empty response body)

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getToken

Token getToken(id)

Get access token

Get a single access token by ID.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.AccessTokensApi();
let id = "id_example"; // String | The ID of the access token
apiInstance.getToken(id, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
id String The ID of the access token

Return type

Token

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getTokens

Tokens getTokens(opts)

List access tokens

Fetch a list of all access tokens.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.AccessTokensApi();
let opts = {
  'showAll': true, // Boolean | If set to true, and the authentication access token has the 'Admin' role, personal access tokens for all members will be retrieved.
  'limit': 789, // Number | The number of access tokens to return in the response. Defaults to 25.
  'offset': 789 // Number | Where to start in the list. This is for use with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`.
};
apiInstance.getTokens(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
showAll Boolean If set to true, and the authentication access token has the 'Admin' role, personal access tokens for all members will be retrieved. [optional]
limit Number The number of access tokens to return in the response. Defaults to 25. [optional]
offset Number Where to start in the list. This is for use with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. [optional]

Return type

Tokens

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

patchToken

Token patchToken(id, patchOperation)

Patch access token

Update an access token's settings. Updating an access token uses a JSON patch representation of the desired changes. To learn more, read Updates.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.AccessTokensApi();
let id = "id_example"; // String | The ID of the access token to update
let patchOperation = [{"op":"replace","path":"/role","value":"writer"}]; // [PatchOperation] | 
apiInstance.patchToken(id, patchOperation, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
id String The ID of the access token to update
patchOperation [PatchOperation]

Return type

Token

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

postToken

Token postToken(accessTokenPost)

Create access token

Create a new access token.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.AccessTokensApi();
let accessTokenPost = {"role":"reader"}; // AccessTokenPost | 
apiInstance.postToken(accessTokenPost, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
accessTokenPost AccessTokenPost

Return type

Token

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

resetToken

Token resetToken(id, opts)

Reset access token

Reset an access token's secret key with an optional expiry time for the old key.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.AccessTokensApi();
let id = "id_example"; // String | The ID of the access token to update
let opts = {
  'expiry': 789 // Number | An expiration time for the old token key, expressed as a Unix epoch time in milliseconds. By default, the token will expire immediately.
};
apiInstance.resetToken(id, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
id String The ID of the access token to update
expiry Number An expiration time for the old token key, expressed as a Unix epoch time in milliseconds. By default, the token will expire immediately. [optional]

Return type

Token

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json