Skip to content

Latest commit

 

History

History
521 lines (361 loc) · 16.9 KB

File metadata and controls

521 lines (361 loc) · 16.9 KB

launchdarkly_api.AccessTokensApi

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

Method HTTP request Description
delete_token DELETE /api/v2/tokens/{id} Delete access token
get_token GET /api/v2/tokens/{id} Get access token
get_tokens GET /api/v2/tokens List access tokens
patch_token PATCH /api/v2/tokens/{id} Patch access token
post_token POST /api/v2/tokens Create access token
reset_token POST /api/v2/tokens/{id}/reset Reset access token

delete_token

delete_token(id)

Delete access token

Delete an access token by ID.

Example

  • Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = launchdarkly_api.AccessTokensApi(api_client)
    id = 'id_example' # str | The ID of the access token to update

    try:
        # Delete access token
        api_instance.delete_token(id)
    except Exception as e:
        print("Exception when calling AccessTokensApi->delete_token: %s\n" % e)

Parameters

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

Return type

void (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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_token

Token get_token(id)

Get access token

Get a single access token by ID.

Example

  • Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.token import Token
from launchdarkly_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = launchdarkly_api.AccessTokensApi(api_client)
    id = 'id_example' # str | The ID of the access token

    try:
        # Get access token
        api_response = api_instance.get_token(id)
        print("The response of AccessTokensApi->get_token:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AccessTokensApi->get_token: %s\n" % e)

Parameters

Name Type Description Notes
id str 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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_tokens

Tokens get_tokens(show_all=show_all, limit=limit, offset=offset)

List access tokens

Fetch a list of all access tokens.

Example

  • Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.tokens import Tokens
from launchdarkly_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = launchdarkly_api.AccessTokensApi(api_client)
    show_all = True # bool | If set to true, and the authentication access token has the 'Admin' role, personal access tokens for all members will be retrieved. (optional)
    limit = 56 # int | The number of access tokens to return in the response. Defaults to 25. (optional)
    offset = 56 # int | 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)

    try:
        # List access tokens
        api_response = api_instance.get_tokens(show_all=show_all, limit=limit, offset=offset)
        print("The response of AccessTokensApi->get_tokens:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AccessTokensApi->get_tokens: %s\n" % e)

Parameters

Name Type Description Notes
show_all bool If set to true, and the authentication access token has the 'Admin' role, personal access tokens for all members will be retrieved. [optional]
limit int The number of access tokens to return in the response. Defaults to 25. [optional]
offset int 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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

patch_token

Token patch_token(id, patch_operation)

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

  • Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.patch_operation import PatchOperation
from launchdarkly_api.models.token import Token
from launchdarkly_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = launchdarkly_api.AccessTokensApi(api_client)
    id = 'id_example' # str | The ID of the access token to update
    patch_operation = [{"op":"replace","path":"/role","value":"writer"}] # List[PatchOperation] | 

    try:
        # Patch access token
        api_response = api_instance.patch_token(id, patch_operation)
        print("The response of AccessTokensApi->patch_token:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AccessTokensApi->patch_token: %s\n" % e)

Parameters

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

post_token

Token post_token(access_token_post)

Create access token

Create a new access token.

Example

  • Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.access_token_post import AccessTokenPost
from launchdarkly_api.models.token import Token
from launchdarkly_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = launchdarkly_api.AccessTokensApi(api_client)
    access_token_post = {"role":"reader"} # AccessTokenPost | 

    try:
        # Create access token
        api_response = api_instance.post_token(access_token_post)
        print("The response of AccessTokensApi->post_token:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AccessTokensApi->post_token: %s\n" % e)

Parameters

Name Type Description Notes
access_token_post 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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

reset_token

Token reset_token(id, expiry=expiry)

Reset access token

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

Example

  • Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.token import Token
from launchdarkly_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = launchdarkly_api.AccessTokensApi(api_client)
    id = 'id_example' # str | The ID of the access token to update
    expiry = 56 # int | An expiration time for the old token key, expressed as a Unix epoch time in milliseconds. By default, the token will expire immediately. (optional)

    try:
        # Reset access token
        api_response = api_instance.reset_token(id, expiry=expiry)
        print("The response of AccessTokensApi->reset_token:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling AccessTokensApi->reset_token: %s\n" % e)

Parameters

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]