All URIs are relative to https://app.launchdarkly.com
Method | HTTP request | Description |
---|---|---|
get_expiring_flags_for_user | GET /api/v2/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey} | Get expiring dates on flags for user |
get_user_flag_setting | GET /api/v2/users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey} | Get flag setting for user |
get_user_flag_settings | GET /api/v2/users/{projectKey}/{environmentKey}/{userKey}/flags | List flag settings for user |
patch_expiring_flags_for_user | PATCH /api/v2/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey} | Update expiring user target for flags |
put_flag_setting | PUT /api/v2/users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey} | Update flag settings for user |
ExpiringUserTargetGetResponse get_expiring_flags_for_user(project_key, user_key, environment_key)
Get expiring dates on flags for user
Get a list of flags for which the given user is scheduled for removal.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import user_settings_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.expiring_user_target_get_response import ExpiringUserTargetGetResponse
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 = user_settings_api.UserSettingsApi(api_client)
project_key = "projectKey_example" # str | The project key
user_key = "userKey_example" # str | The user key
environment_key = "environmentKey_example" # str | The environment key
# example passing only required values which don't have defaults set
try:
# Get expiring dates on flags for user
api_response = api_instance.get_expiring_flags_for_user(project_key, user_key, environment_key)
pprint(api_response)
except launchdarkly_api.ApiException as e:
print("Exception when calling UserSettingsApi->get_expiring_flags_for_user: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
project_key | str | The project key | |
user_key | str | The user key | |
environment_key | str | The environment key |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Expiring user target 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]
UserFlagSetting get_user_flag_setting(project_key, environment_key, user_key, feature_flag_key)
Get flag setting for user
Get a single flag setting for a user by flag key.
The _value
is the flag variation that the user receives. The setting
indicates whether you've explicitly targeted a user to receive a particular variation. For example, if you have turned off a feature flag for a user, this setting will be false
. The example response indicates that the user Abbie_Braun
has the sort.order
flag enabled.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import user_settings_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.user_flag_setting import UserFlagSetting
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 = user_settings_api.UserSettingsApi(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
feature_flag_key = "featureFlagKey_example" # str | The feature flag key
# example passing only required values which don't have defaults set
try:
# Get flag setting for user
api_response = api_instance.get_user_flag_setting(project_key, environment_key, user_key, feature_flag_key)
pprint(api_response)
except launchdarkly_api.ApiException as e:
print("Exception when calling UserSettingsApi->get_user_flag_setting: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
project_key | str | The project key | |
environment_key | str | The environment key | |
user_key | str | The user key | |
feature_flag_key | str | The feature flag key |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | User flag settings 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]
UserFlagSettings get_user_flag_settings(project_key, environment_key, user_key)
List flag settings for user
Get the current flag settings for a given user.
The _value
is the flag variation that the user receives. The setting
indicates whether you've explicitly targeted a user to receive a particular variation. For example, if you have turned off a feature flag for a user, this setting will be false
. The example response indicates that the user Abbie_Braun
has the sort.order
flag enabled and the alternate.page
flag disabled, and that the user has not been explicitly targeted to receive a particular variation.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import user_settings_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.user_flag_settings import UserFlagSettings
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 = user_settings_api.UserSettingsApi(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:
# List flag settings for user
api_response = api_instance.get_user_flag_settings(project_key, environment_key, user_key)
pprint(api_response)
except launchdarkly_api.ApiException as e:
print("Exception when calling UserSettingsApi->get_user_flag_settings: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
project_key | str | The project key | |
environment_key | str | The environment key | |
user_key | str | The user key |
- Content-Type: Not defined
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | User flag settings 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]
ExpiringUserTargetPatchResponse patch_expiring_flags_for_user(project_key, user_key, environment_key, patch_users_request)
Update expiring user target for flags
Schedule the specified user for removal from individual targeting on one or more flags. The user must already be individually targeted for each flag. You can add, update, or remove a scheduled removal date. You can only schedule a user for removal on a single variation per flag. Updating an expiring target uses the semantic patch format. To make a semantic patch request, you must append domain-model=launchdarkly.semanticpatch
to your Content-Type
header. To learn more, read Updates using semantic patch. ### Instructions Semantic patch requests support the following kind
instructions for updating expiring user targets.
Click to expand instructions for updating expiring user targets
#### addExpireUserTargetDate Adds a date and time that LaunchDarkly will remove the user from the flag's individual targeting. ##### Parameters *flagKey
: The flag key * variationId
: ID of a variation on the flag * value
: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag. #### updateExpireUserTargetDate Updates the date and time that LaunchDarkly will remove the user from the flag's individual targeting. ##### Parameters * flagKey
: The flag key * variationId
: ID of a variation on the flag * value
: The time, in Unix milliseconds, when LaunchDarkly should remove the user from individual targeting for this flag. * version
: The version of the expiring user target to update. If included, update will fail if version doesn't match current version of the expiring user target. #### removeExpireUserTargetDate Removes the scheduled removal of the user from the flag's individual targeting. The user will remain part of the flag's individual targeting until explicitly removed, or until another removal is scheduled. ##### Parameters * flagKey
: The flag key * variationId
: ID of a variation on the flag - Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import user_settings_api
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.expiring_user_target_patch_response import ExpiringUserTargetPatchResponse
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.patch_users_request import PatchUsersRequest
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 = user_settings_api.UserSettingsApi(api_client)
project_key = "projectKey_example" # str | The project key
user_key = "userKey_example" # str | The user key
environment_key = "environmentKey_example" # str | The environment key
patch_users_request = PatchUsersRequest(
comment="optional comment",
instructions=[
InstructionUserRequest(
kind="addExpireUserTargetDate",
flag_key="sample-flag-key",
variation_id="ce12d345-a1b2-4fb5-a123-ab123d4d5f5d",
value=1653469200000,
version=1,
),
],
) # PatchUsersRequest |
# example passing only required values which don't have defaults set
try:
# Update expiring user target for flags
api_response = api_instance.patch_expiring_flags_for_user(project_key, user_key, environment_key, patch_users_request)
pprint(api_response)
except launchdarkly_api.ApiException as e:
print("Exception when calling UserSettingsApi->patch_expiring_flags_for_user: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
project_key | str | The project key | |
user_key | str | The user key | |
environment_key | str | The environment key | |
patch_users_request | PatchUsersRequest |
ExpiringUserTargetPatchResponse
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
200 | Expiring user target 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]
put_flag_setting(project_key, environment_key, user_key, feature_flag_key, value_put)
Update flag settings for user
Enable or disable a feature flag for a user based on their key. Omitting the setting
attribute from the request body, or including a setting
of null
, erases the current setting for a user. If you previously patched the flag, and the patch included the user's data, LaunchDarkly continues to use that data. If LaunchDarkly has never encountered the user's key before, it calculates the flag values based on the user key alone.
- Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import user_settings_api
from launchdarkly_api.model.value_put import ValuePut
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 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 = user_settings_api.UserSettingsApi(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
feature_flag_key = "featureFlagKey_example" # str | The feature flag key
value_put = ValuePut(
setting=None,
comment="make sure this context experiences a specific variation",
) # ValuePut |
# example passing only required values which don't have defaults set
try:
# Update flag settings for user
api_instance.put_flag_setting(project_key, environment_key, user_key, feature_flag_key, value_put)
except launchdarkly_api.ApiException as e:
print("Exception when calling UserSettingsApi->put_flag_setting: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
project_key | str | The project key | |
environment_key | str | The environment key | |
user_key | str | The user key | |
feature_flag_key | str | The feature flag key | |
value_put | ValuePut |
void (empty response body)
- Content-Type: application/json
- Accept: application/json
Status code | Description | Response headers |
---|---|---|
204 | Action succeeded | - |
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]