Skip to content

Latest commit

 

History

History
410 lines (308 loc) · 17.8 KB

UsersApi.md

File metadata and controls

410 lines (308 loc) · 17.8 KB

launchdarkly_api.UsersApi

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

Method HTTP request Description
delete_user DELETE /api/v2/users/{projectKey}/{environmentKey}/{userKey} Delete user
get_search_users GET /api/v2/user-search/{projectKey}/{environmentKey} Find users
get_user GET /api/v2/users/{projectKey}/{environmentKey}/{userKey} Get user
get_users GET /api/v2/users/{projectKey}/{environmentKey} List users

delete_user

delete_user(project_key, environment_key, user_key)

Delete user

Use contexts instead > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Delete context instances instead of this endpoint. Delete a user by key.

Example

  • Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import users_api
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from launchdarkly_api.model.status_conflict_error_rep import StatusConflictErrorRep
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'] = 'YOUR_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 = users_api.UsersApi(api_client)
    project_key = "projectKey_example" # str | The project key
    environment_key = "environmentKey_example" # str | The environment key
    user_key = "userKey_example" # str | The user key

    # example passing only required values which don't have defaults set
    try:
        # Delete user
        api_instance.delete_user(project_key, environment_key, user_key)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling UsersApi->delete_user: %s\n" % e)

Parameters

Name Type Description Notes
project_key str The project key
environment_key str The environment key
user_key str The user key

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 -
409 Status conflict -
429 Rate limited -

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

get_search_users

Users get_search_users(project_key, environment_key)

Find users

Use contexts instead > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Search for context instances instead of this endpoint. Search users in LaunchDarkly based on their last active date, a user attribute filter set, or a search query. An example user attribute filter set is filter=firstName:Anna,activeTrial:false. This matches users that have the user attribute firstName set to Anna, that also have the attribute activeTrial set to false. To paginate through results, follow the next link in the _links object. To learn more, read Representations.

Example

  • Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import users_api
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.users import Users
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
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'] = 'YOUR_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 = users_api.UsersApi(api_client)
    project_key = "projectKey_example" # str | The project key
    environment_key = "environmentKey_example" # str | The environment key
    q = "q_example" # str | Full-text search for users based on name, first name, last name, e-mail address, or key (optional)
    limit = 1 # int | Specifies the maximum number of items in the collection to return (max: 50, default: 20) (optional)
    offset = 1 # int | Deprecated, use `searchAfter` instead. Specifies the first item to return in the collection. (optional)
    after = 1 # int | A Unix epoch time in milliseconds specifying the maximum last time a user requested a feature flag from LaunchDarkly (optional)
    sort = "sort_example" # str | Specifies a field by which to sort. LaunchDarkly supports the `userKey` and `lastSeen` fields. Fields prefixed by a dash ( - ) sort in descending order. (optional)
    search_after = "searchAfter_example" # str | Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the `next` link we provide instead. (optional)
    filter = "filter_example" # str | A comma-separated list of user attribute filters. Each filter is in the form of attributeKey:attributeValue (optional)

    # example passing only required values which don't have defaults set
    try:
        # Find users
        api_response = api_instance.get_search_users(project_key, environment_key)
        pprint(api_response)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling UsersApi->get_search_users: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Find users
        api_response = api_instance.get_search_users(project_key, environment_key, q=q, limit=limit, offset=offset, after=after, sort=sort, search_after=search_after, filter=filter)
        pprint(api_response)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling UsersApi->get_search_users: %s\n" % e)

Parameters

Name Type Description Notes
project_key str The project key
environment_key str The environment key
q str Full-text search for users based on name, first name, last name, e-mail address, or key [optional]
limit int Specifies the maximum number of items in the collection to return (max: 50, default: 20) [optional]
offset int Deprecated, use `searchAfter` instead. Specifies the first item to return in the collection. [optional]
after int A Unix epoch time in milliseconds specifying the maximum last time a user requested a feature flag from LaunchDarkly [optional]
sort str Specifies a field by which to sort. LaunchDarkly supports the `userKey` and `lastSeen` fields. Fields prefixed by a dash ( - ) sort in descending order. [optional]
search_after str Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the `next` link we provide instead. [optional]
filter str A comma-separated list of user attribute filters. Each filter is in the form of attributeKey:attributeValue [optional]

Return type

Users

Authorization

ApiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Users collection response -
400 Invalid request -
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_user

UserRecord get_user(project_key, environment_key, user_key)

Get user

Use contexts instead > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Get context instances instead of this endpoint. Get a user by key. The user object contains all attributes sent in variation calls for that key.

Example

  • Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import users_api
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from launchdarkly_api.model.user_record import UserRecord
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'] = 'YOUR_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 = users_api.UsersApi(api_client)
    project_key = "projectKey_example" # str | The project key
    environment_key = "environmentKey_example" # str | The environment key
    user_key = "userKey_example" # str | The user key

    # example passing only required values which don't have defaults set
    try:
        # Get user
        api_response = api_instance.get_user(project_key, environment_key, user_key)
        pprint(api_response)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling UsersApi->get_user: %s\n" % e)

Parameters

Name Type Description Notes
project_key str The project key
environment_key str The environment key
user_key str The user key

Return type

UserRecord

Authorization

ApiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 User response -
400 Invalid request -
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_users

UsersRep get_users(project_key, environment_key)

List users

Use contexts instead > > After you have upgraded your LaunchDarkly SDK to use contexts instead of users, you should use Search for contexts instead of this endpoint. List all users in the environment. Includes the total count of users. This is useful for exporting all users in the system for further analysis. Each page displays users up to a set limit. The default is 20. To page through, follow the next link in the _links object. To learn more, read Representations.

Example

  • Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import users_api
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.users_rep import UsersRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
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'] = 'YOUR_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 = users_api.UsersApi(api_client)
    project_key = "projectKey_example" # str | The project key
    environment_key = "environmentKey_example" # str | The environment key
    limit = 1 # int | The number of elements to return per page (optional)
    search_after = "searchAfter_example" # str | Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the `next` link we provide instead. (optional)

    # example passing only required values which don't have defaults set
    try:
        # List users
        api_response = api_instance.get_users(project_key, environment_key)
        pprint(api_response)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling UsersApi->get_users: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # List users
        api_response = api_instance.get_users(project_key, environment_key, limit=limit, search_after=search_after)
        pprint(api_response)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling UsersApi->get_users: %s\n" % e)

Parameters

Name Type Description Notes
project_key str The project key
environment_key str The environment key
limit int The number of elements to return per page [optional]
search_after str Limits results to users with sort values after the value you specify. You can use this for pagination, but we recommend using the `next` link we provide instead. [optional]

Return type

UsersRep

Authorization

ApiKey

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Users collection response -
400 Invalid request -
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]