Skip to content
This repository was archived by the owner on Feb 3, 2026. It is now read-only.

Latest commit

 

History

History
349 lines (246 loc) · 15.1 KB

File metadata and controls

349 lines (246 loc) · 15.1 KB

LaunchDarklyApi\UserSettingsApi

All URIs are relative to https://app.launchdarkly.com, except if the operation defines another base path.

Method HTTP request Description
getExpiringFlagsForUser() GET /api/v2/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey} Get expiring dates on flags for user
getUserFlagSetting() GET /api/v2/users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey} Get flag setting for user
getUserFlagSettings() GET /api/v2/users/{projectKey}/{environmentKey}/{userKey}/flags List flag settings for user
patchExpiringFlagsForUser() PATCH /api/v2/users/{projectKey}/{userKey}/expiring-user-targets/{environmentKey} Update expiring user target for flags
putFlagSetting() PUT /api/v2/users/{projectKey}/{environmentKey}/{userKey}/flags/{featureFlagKey} Update flag settings for user

getExpiringFlagsForUser()

getExpiringFlagsForUser($project_key, $user_key, $environment_key): \LaunchDarklyApi\Model\ExpiringUserTargetGetResponse

Get expiring dates on flags for user

Get a list of flags for which the given user is scheduled for removal.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKey
$config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new LaunchDarklyApi\Api\UserSettingsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$project_key = 'project_key_example'; // string | The project key
$user_key = 'user_key_example'; // string | The user key
$environment_key = 'environment_key_example'; // string | The environment key

try {
    $result = $apiInstance->getExpiringFlagsForUser($project_key, $user_key, $environment_key);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UserSettingsApi->getExpiringFlagsForUser: ', $e->getMessage(), PHP_EOL;
}

Parameters

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

Return type

\LaunchDarklyApi\Model\ExpiringUserTargetGetResponse

Authorization

ApiKey

HTTP request headers

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

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

getUserFlagSetting()

getUserFlagSetting($project_key, $environment_key, $user_key, $feature_flag_key): \LaunchDarklyApi\Model\UserFlagSetting

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.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKey
$config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new LaunchDarklyApi\Api\UserSettingsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$project_key = 'project_key_example'; // string | The project key
$environment_key = 'environment_key_example'; // string | The environment key
$user_key = 'user_key_example'; // string | The user key
$feature_flag_key = 'feature_flag_key_example'; // string | The feature flag key

try {
    $result = $apiInstance->getUserFlagSetting($project_key, $environment_key, $user_key, $feature_flag_key);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UserSettingsApi->getUserFlagSetting: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
project_key string The project key
environment_key string The environment key
user_key string The user key
feature_flag_key string The feature flag key

Return type

\LaunchDarklyApi\Model\UserFlagSetting

Authorization

ApiKey

HTTP request headers

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

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

getUserFlagSettings()

getUserFlagSettings($project_key, $environment_key, $user_key): \LaunchDarklyApi\Model\UserFlagSettings

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.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKey
$config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new LaunchDarklyApi\Api\UserSettingsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$project_key = 'project_key_example'; // string | The project key
$environment_key = 'environment_key_example'; // string | The environment key
$user_key = 'user_key_example'; // string | The user key

try {
    $result = $apiInstance->getUserFlagSettings($project_key, $environment_key, $user_key);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UserSettingsApi->getUserFlagSettings: ', $e->getMessage(), PHP_EOL;
}

Parameters

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

Return type

\LaunchDarklyApi\Model\UserFlagSettings

Authorization

ApiKey

HTTP request headers

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

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

patchExpiringFlagsForUser()

patchExpiringFlagsForUser($project_key, $user_key, $environment_key, $patch_users_request): \LaunchDarklyApi\Model\ExpiringUserTargetPatchResponse

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

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKey
$config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new LaunchDarklyApi\Api\UserSettingsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$project_key = 'project_key_example'; // string | The project key
$user_key = 'user_key_example'; // string | The user key
$environment_key = 'environment_key_example'; // string | The environment key
$patch_users_request = new \LaunchDarklyApi\Model\PatchUsersRequest(); // \LaunchDarklyApi\Model\PatchUsersRequest

try {
    $result = $apiInstance->patchExpiringFlagsForUser($project_key, $user_key, $environment_key, $patch_users_request);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling UserSettingsApi->patchExpiringFlagsForUser: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
project_key string The project key
user_key string The user key
environment_key string The environment key
patch_users_request \LaunchDarklyApi\Model\PatchUsersRequest

Return type

\LaunchDarklyApi\Model\ExpiringUserTargetPatchResponse

Authorization

ApiKey

HTTP request headers

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

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

putFlagSetting()

putFlagSetting($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.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');


// Configure API key authorization: ApiKey
$config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKey('Authorization', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = LaunchDarklyApi\Configuration::getDefaultConfiguration()->setApiKeyPrefix('Authorization', 'Bearer');


$apiInstance = new LaunchDarklyApi\Api\UserSettingsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$project_key = 'project_key_example'; // string | The project key
$environment_key = 'environment_key_example'; // string | The environment key
$user_key = 'user_key_example'; // string | The user key
$feature_flag_key = 'feature_flag_key_example'; // string | The feature flag key
$value_put = new \LaunchDarklyApi\Model\ValuePut(); // \LaunchDarklyApi\Model\ValuePut

try {
    $apiInstance->putFlagSetting($project_key, $environment_key, $user_key, $feature_flag_key, $value_put);
} catch (Exception $e) {
    echo 'Exception when calling UserSettingsApi->putFlagSetting: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
project_key string The project key
environment_key string The environment key
user_key string The user key
feature_flag_key string The feature flag key
value_put \LaunchDarklyApi\Model\ValuePut

Return type

void (empty response body)

Authorization

ApiKey

HTTP request headers

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

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