Skip to content

Latest commit

 

History

History
461 lines (361 loc) · 15.3 KB

AccessTokensApi.md

File metadata and controls

461 lines (361 loc) · 15.3 KB

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 classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.AccessTokensApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    AccessTokensApi apiInstance = new AccessTokensApi(defaultClient);
    String id = "id_example"; // String | The ID of the access token to update
    try {
      apiInstance.deleteToken(id);
    } catch (ApiException e) {
      System.err.println("Exception when calling AccessTokensApi#deleteToken");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

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

HTTP response details

Status code Description Response headers
204 Action succeeded -
401 Invalid access token -
403 Forbidden -
404 Invalid resource identifier -
429 Rate limited -

getToken

Token getToken(id)

Get access token

Get a single access token by ID.

Example

// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.AccessTokensApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    AccessTokensApi apiInstance = new AccessTokensApi(defaultClient);
    String id = "id_example"; // String | The ID of the access token
    try {
      Token result = apiInstance.getToken(id);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AccessTokensApi#getToken");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

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

HTTP response details

Status code Description Response headers
200 Access token response -
401 Invalid access token -
403 Forbidden -
404 Invalid resource identifier -
429 Rate limited -

getTokens

Tokens getTokens(showAll, limit, offset)

List access tokens

Fetch a list of all access tokens.

Example

// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.AccessTokensApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    AccessTokensApi apiInstance = new AccessTokensApi(defaultClient);
    Boolean 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.
    Long limit = 56L; // Long | The number of access tokens to return in the response. Defaults to 25.
    Long offset = 56L; // Long | 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`.
    try {
      Tokens result = apiInstance.getTokens(showAll, limit, offset);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AccessTokensApi#getTokens");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

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 Long The number of access tokens to return in the response. Defaults to 25. [optional]
offset Long 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

HTTP response details

Status code Description Response headers
200 Access tokens collection response -
401 Invalid access token -
403 Forbidden -
429 Rate limited -

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 classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.AccessTokensApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    AccessTokensApi apiInstance = new AccessTokensApi(defaultClient);
    String id = "id_example"; // String | The ID of the access token to update
    List<PatchOperation> patchOperation = Arrays.asList(); // List<PatchOperation> | 
    try {
      Token result = apiInstance.patchToken(id, patchOperation);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AccessTokensApi#patchToken");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
id String The ID of the access token to update
patchOperation List<PatchOperation>

Return type

Token

Authorization

ApiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Access token response -
400 Invalid request -
401 Invalid access token -
403 Forbidden -
404 Invalid resource identifier -
409 Status conflict -
422 Invalid patch content -
429 Rate limited -

postToken

Token postToken(accessTokenPost)

Create access token

Create a new access token.

Example

// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.AccessTokensApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    AccessTokensApi apiInstance = new AccessTokensApi(defaultClient);
    AccessTokenPost accessTokenPost = new AccessTokenPost(); // AccessTokenPost | 
    try {
      Token result = apiInstance.postToken(accessTokenPost);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AccessTokensApi#postToken");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
accessTokenPost AccessTokenPost

Return type

Token

Authorization

ApiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 Access token response -
400 Invalid request -
401 Invalid access token -
403 Forbidden -
429 Rate limited -

resetToken

Token resetToken(id, expiry)

Reset access token

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

Example

// Import classes:
import com.launchdarkly.api.ApiClient;
import com.launchdarkly.api.ApiException;
import com.launchdarkly.api.Configuration;
import com.launchdarkly.api.auth.*;
import com.launchdarkly.api.models.*;
import com.launchdarkly.api.api.AccessTokensApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = Configuration.getDefaultApiClient();
    defaultClient.setBasePath("https://app.launchdarkly.com");
    
    // Configure API key authorization: ApiKey
    ApiKeyAuth ApiKey = (ApiKeyAuth) defaultClient.getAuthentication("ApiKey");
    ApiKey.setApiKey("YOUR API KEY");
    // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
    //ApiKey.setApiKeyPrefix("Token");

    AccessTokensApi apiInstance = new AccessTokensApi(defaultClient);
    String id = "id_example"; // String | The ID of the access token to update
    Long expiry = 56L; // Long | An expiration time for the old token key, expressed as a Unix epoch time in milliseconds. By default, the token will expire immediately.
    try {
      Token result = apiInstance.resetToken(id, expiry);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling AccessTokensApi#resetToken");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

Name Type Description Notes
id String The ID of the access token to update
expiry Long 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

HTTP response details

Status code Description Response headers
200 Access token response -
401 Invalid access token -
403 Forbidden -
404 Invalid resource identifier -
429 Rate limited -