All URIs are relative to https://app.launchdarkly.com
| Method | HTTP request | Description |
|---|---|---|
| delete_environment | DELETE /api/v2/projects/{projectKey}/environments/{environmentKey} | Delete environment |
| get_environment | GET /api/v2/projects/{projectKey}/environments/{environmentKey} | Get environment |
| get_environments_by_project | GET /api/v2/projects/{projectKey}/environments | List environments |
| patch_environment | PATCH /api/v2/projects/{projectKey}/environments/{environmentKey} | Update environment |
| post_environment | POST /api/v2/projects/{projectKey}/environments | Create environment |
| reset_environment_mobile_key | POST /api/v2/projects/{projectKey}/environments/{environmentKey}/mobileKey | Reset environment mobile SDK key |
| reset_environment_sdk_key | POST /api/v2/projects/{projectKey}/environments/{environmentKey}/apiKey | Reset environment SDK key |
delete_environment(project_key, environment_key)
Delete environment
Delete a environment by key.
- 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.EnvironmentsApi(api_client)
project_key = 'project_key_example' # str | The project key
environment_key = 'environment_key_example' # str | The environment key
try:
# Delete environment
api_instance.delete_environment(project_key, environment_key)
except Exception as e:
print("Exception when calling EnvironmentsApi->delete_environment: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | str | The project key | |
| environment_key | str | The environment key |
void (empty response body)
- Content-Type: Not defined
- Accept: application/json
| 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]
Environment get_environment(project_key, environment_key)
Get environment
The
approvalSettingskey is only returned when approvals for flags or segments are enabled.
Get an environment given a project and key.
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.environment import Environment
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.EnvironmentsApi(api_client)
project_key = 'project_key_example' # str | The project key
environment_key = 'environment_key_example' # str | The environment key
try:
# Get environment
api_response = api_instance.get_environment(project_key, environment_key)
print("The response of EnvironmentsApi->get_environment:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EnvironmentsApi->get_environment: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | str | The project key | |
| environment_key | str | The environment key |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Environment 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]
Environments get_environments_by_project(project_key, limit=limit, offset=offset, filter=filter, sort=sort)
List 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.
LaunchDarkly supports two fields for filters:
queryis a string that matches against the environments' names and keys. It is not case sensitive.tagsis 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.
LaunchDarkly supports the following fields for sorting:
createdOnsorts by the creation date of the environment.criticalsorts by whether the environments are marked as critical.namesorts by environment name.
For example, sort=name sorts the response by environment name in ascending order.
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.environments import Environments
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.EnvironmentsApi(api_client)
project_key = 'project_key_example' # str | The project key
limit = 56 # int | The number of environments to return in the response. Defaults to 20. (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)
filter = 'filter_example' # str | A comma-separated list of filters. Each filter is of the form `field:value`. (optional)
sort = 'sort_example' # str | A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. (optional)
try:
# List environments
api_response = api_instance.get_environments_by_project(project_key, limit=limit, offset=offset, filter=filter, sort=sort)
print("The response of EnvironmentsApi->get_environments_by_project:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EnvironmentsApi->get_environments_by_project: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | str | 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 | str | A comma-separated list of filters. Each filter is of the form `field:value`. | [optional] |
| sort | str | A comma-separated list of fields to sort by. Fields prefixed by a dash ( - ) sort in descending order. | [optional] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Environments collection response | - |
| 400 | Invalid request | - |
| 401 | Invalid access token | - |
| 403 | Forbidden | - |
| 404 | Invalid resource identifier | - |
| 405 | Method not allowed | - |
| 429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Environment patch_environment(project_key, environment_key, patch_operation)
Update 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.
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.
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.environment import Environment
from launchdarkly_api.models.patch_operation import PatchOperation
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.EnvironmentsApi(api_client)
project_key = 'project_key_example' # str | The project key
environment_key = 'environment_key_example' # str | The environment key
patch_operation = [{"op":"replace","path":"/requireComments","value":true}] # List[PatchOperation] |
try:
# Update environment
api_response = api_instance.patch_environment(project_key, environment_key, patch_operation)
print("The response of EnvironmentsApi->patch_environment:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EnvironmentsApi->patch_environment: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | str | The project key | |
| environment_key | str | The environment key | |
| patch_operation | List[PatchOperation] |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Environment response | - |
| 400 | Invalid request | - |
| 401 | Invalid access token | - |
| 404 | Invalid resource identifier | - |
| 409 | Status conflict | - |
| 429 | Rate limited | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Environment post_environment(project_key, environment_post)
Create environment
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.
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.environment import Environment
from launchdarkly_api.models.environment_post import EnvironmentPost
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.EnvironmentsApi(api_client)
project_key = 'project_key_example' # str | The project key
environment_post = {"color":"DADBEE","key":"environment-key-123abc","name":"My Environment"} # EnvironmentPost |
try:
# Create environment
api_response = api_instance.post_environment(project_key, environment_post)
print("The response of EnvironmentsApi->post_environment:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EnvironmentsApi->post_environment: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | str | The project key | |
| environment_post | EnvironmentPost |
- Content-Type: application/json
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 201 | Environment response | - |
| 400 | Invalid request | - |
| 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]
Environment reset_environment_mobile_key(project_key, environment_key)
Reset 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.
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.environment import Environment
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.EnvironmentsApi(api_client)
project_key = 'project_key_example' # str | The project key
environment_key = 'environment_key_example' # str | The environment key
try:
# Reset environment mobile SDK key
api_response = api_instance.reset_environment_mobile_key(project_key, environment_key)
print("The response of EnvironmentsApi->reset_environment_mobile_key:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EnvironmentsApi->reset_environment_mobile_key: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | str | The project key | |
| environment_key | str | The environment key |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Environment response | - |
| 400 | Invalid request | - |
| 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]
Environment reset_environment_sdk_key(project_key, environment_key, expiry=expiry)
Reset environment SDK key
Reset an environment's SDK key with an optional expiry time for the old key.
- Api Key Authentication (ApiKey):
import launchdarkly_api
from launchdarkly_api.models.environment import Environment
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.EnvironmentsApi(api_client)
project_key = 'project_key_example' # str | The project key
environment_key = 'environment_key_example' # str | 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. (optional)
try:
# Reset environment SDK key
api_response = api_instance.reset_environment_sdk_key(project_key, environment_key, expiry=expiry)
print("The response of EnvironmentsApi->reset_environment_sdk_key:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling EnvironmentsApi->reset_environment_sdk_key: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| project_key | str | The project key | |
| environment_key | str | 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] |
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | Environment response | - |
| 400 | Invalid request | - |
| 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]