All URIs are relative to https://app.launchdarkly.com, except if the operation defines another base path.
| Method | HTTP request | Description |
|---|---|---|
| deleteEnvironment() | DELETE /api/v2/projects/{projectKey}/environments/{environmentKey} | Delete environment |
| getEnvironment() | GET /api/v2/projects/{projectKey}/environments/{environmentKey} | Get environment |
| getEnvironmentsByProject() | GET /api/v2/projects/{projectKey}/environments | List environments |
| patchEnvironment() | PATCH /api/v2/projects/{projectKey}/environments/{environmentKey} | Update environment |
| postEnvironment() | POST /api/v2/projects/{projectKey}/environments | Create environment |
| resetEnvironmentMobileKey() | POST /api/v2/projects/{projectKey}/environments/{environmentKey}/mobileKey | Reset environment mobile SDK key |
| resetEnvironmentSDKKey() | POST /api/v2/projects/{projectKey}/environments/{environmentKey}/apiKey | Reset environment SDK key |
deleteEnvironment($project_key, $environment_key)Delete environment
Delete a environment by key.
<?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\EnvironmentsApi(
// 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
try {
$apiInstance->deleteEnvironment($project_key, $environment_key);
} catch (Exception $e) {
echo 'Exception when calling EnvironmentsApi->deleteEnvironment: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | string | The project key | |
| environment_key | string | The environment key |
void (empty response body)
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getEnvironment($project_key, $environment_key): \LaunchDarklyApi\Model\EnvironmentGet environment
Approval settings > > The
approvalSettingskey is only returned when approvals for flags or segments are enabled. Get an environment given a project and key.
<?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\EnvironmentsApi(
// 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
try {
$result = $apiInstance->getEnvironment($project_key, $environment_key);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling EnvironmentsApi->getEnvironment: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | string | The project key | |
| environment_key | string | The environment key |
\LaunchDarklyApi\Model\Environment
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
getEnvironmentsByProject($project_key, $limit, $offset, $filter, $sort): \LaunchDarklyApi\Model\EnvironmentsList environments
Return a list of environments for the specified project. By default, this returns the first 20 environments. Page through this list with the limit parameter and by following the first, prev, next, and last links in the _links field that returns. If those links do not appear, the pages they refer to don't exist. For example, the first and prev links will be missing from the response on the first page, because there is no previous page and you cannot return to the first page when you are already on the first page. ### Filtering environments LaunchDarkly supports two fields for filters: - query is a string that matches against the environments' names and keys. It is not case sensitive. - tags is a +-separated list of environment tags. It filters the list of environments that have all of the tags in the list. For example, the filter filter=query:abc,tags:tag-1+tag-2 matches environments with the string abc in their name or key and also are tagged with tag-1 and tag-2. The filter is not case-sensitive. The documented values for filter query parameters are prior to URL encoding. For example, the + in filter=tags:tag-1+tag-2 must be encoded to %2B. ### Sorting environments LaunchDarkly supports the following fields for sorting: - createdOn sorts by the creation date of the environment. - critical sorts by whether the environments are marked as critical. - name sorts by environment name. For example, sort=name sorts the response by environment name in ascending order.
<?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\EnvironmentsApi(
// 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
$limit = 56; // int | The number of environments to return in the response. Defaults to 20.
$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`.
$filter = 'filter_example'; // string | A comma-separated list of filters. Each filter is of the form `field:value`.
$sort = 'sort_example'; // string | A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order.
try {
$result = $apiInstance->getEnvironmentsByProject($project_key, $limit, $offset, $filter, $sort);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling EnvironmentsApi->getEnvironmentsByProject: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | string | The project key | |
| limit | int | The number of environments to return in the response. Defaults to 20. | [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] |
| filter | string | A comma-separated list of filters. Each filter is of the form `field:value`. | [optional] |
| sort | string | A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. | [optional] |
\LaunchDarklyApi\Model\Environments
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
patchEnvironment($project_key, $environment_key, $patch_operation): \LaunchDarklyApi\Model\EnvironmentUpdate environment
Update an environment. Updating an environment uses a JSON patch representation of the desired changes. To learn more, read Updates. To update fields in the environment object that are arrays, set the path to the name of the field and then append /<array index>. Using /0 appends to the beginning of the array. ### Approval settings This request only returns the approvalSettings key if the approvals feature is enabled. Only the canReviewOwnRequest, canApplyDeclinedChanges, minNumApprovals, required and requiredApprovalTagsfields are editable. If you try to patch the environment by setting both required and requiredApprovalTags, the request fails and an error appears. You can specify either required approvals for all flags in an environment or those with specific tags, but not both.
<?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\EnvironmentsApi(
// 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
$patch_operation = [{"op":"replace","path":"/requireComments","value":true}]; // \LaunchDarklyApi\Model\PatchOperation[]
try {
$result = $apiInstance->patchEnvironment($project_key, $environment_key, $patch_operation);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling EnvironmentsApi->patchEnvironment: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | string | The project key | |
| environment_key | string | The environment key | |
| patch_operation | \LaunchDarklyApi\Model\PatchOperation[] |
\LaunchDarklyApi\Model\Environment
- Content-Type:
application/json - Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
postEnvironment($project_key, $environment_post): \LaunchDarklyApi\Model\EnvironmentCreate environment
Approval settings > > The
approvalSettingskey is only returned when the approvals feature is enabled. > > You cannot update approval settings when creating new environments. Update approval settings with the [https://launchdarkly.com/docs/api/environments/patch-environment). Create a new environment in a specified project with a given name, key, swatch color, and default TTL.
<?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\EnvironmentsApi(
// 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_post = {"color":"DADBEE","key":"environment-key-123abc","name":"My Environment"}; // \LaunchDarklyApi\Model\EnvironmentPost
try {
$result = $apiInstance->postEnvironment($project_key, $environment_post);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling EnvironmentsApi->postEnvironment: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | string | The project key | |
| environment_post | \LaunchDarklyApi\Model\EnvironmentPost |
\LaunchDarklyApi\Model\Environment
- Content-Type:
application/json - Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
resetEnvironmentMobileKey($project_key, $environment_key): \LaunchDarklyApi\Model\EnvironmentReset environment mobile SDK key
Reset an environment's mobile key. The optional expiry for the old key is deprecated for this endpoint, so the old key will always expire immediately.
<?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\EnvironmentsApi(
// 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
try {
$result = $apiInstance->resetEnvironmentMobileKey($project_key, $environment_key);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling EnvironmentsApi->resetEnvironmentMobileKey: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | string | The project key | |
| environment_key | string | The environment key |
\LaunchDarklyApi\Model\Environment
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
resetEnvironmentSDKKey($project_key, $environment_key, $expiry): \LaunchDarklyApi\Model\EnvironmentReset environment SDK key
Reset an environment's SDK key with an optional expiry time for the old key.
<?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\EnvironmentsApi(
// 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
$expiry = 56; // int | The time at which you want the old SDK key to expire, in UNIX milliseconds. By default, the key expires immediately. During the period between this call and the time when the old SDK key expires, both the old SDK key and the new SDK key will work.
try {
$result = $apiInstance->resetEnvironmentSDKKey($project_key, $environment_key, $expiry);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling EnvironmentsApi->resetEnvironmentSDKKey: ', $e->getMessage(), PHP_EOL;
}| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | string | The project key | |
| environment_key | string | The environment key | |
| expiry | int | The time at which you want the old SDK key to expire, in UNIX milliseconds. By default, the key expires immediately. During the period between this call and the time when the old SDK key expires, both the old SDK key and the new SDK key will work. | [optional] |
\LaunchDarklyApi\Model\Environment
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]