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.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::EnvironmentsApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
begin
# Delete environment
api_instance.delete_environment(project_key, environment_key)
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->delete_environment: #{e}"
end
This returns an Array which contains the response data (nil
in this case), status code and headers.
<Array(nil, Integer, Hash)> delete_environment_with_http_info(project_key, environment_key)
begin
# Delete environment
data, status_code, headers = api_instance.delete_environment_with_http_info(project_key, environment_key)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->delete_environment_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key |
nil (empty response body)
- Content-Type: Not defined
- Accept: application/json
get_environment(project_key, environment_key)
Get environment
Approval settings > > The
approvalSettings
key is only returned when approvals for flags or segments are enabled. Get an environment given a project and key.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::EnvironmentsApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
begin
# Get environment
result = api_instance.get_environment(project_key, environment_key)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->get_environment: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_environment_with_http_info(project_key, environment_key)
begin
# Get environment
data, status_code, headers = api_instance.get_environment_with_http_info(project_key, environment_key)
p status_code # => 2xx
p headers # => { ... }
p data # => <Environment>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->get_environment_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key |
- Content-Type: Not defined
- Accept: application/json
get_environments_by_project(project_key, opts)
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. ### 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.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::EnvironmentsApi.new
project_key = 'project_key_example' # String | The project key
opts = {
limit: 789, # Integer | The number of environments to return in the response. Defaults to 20.
offset: 789, # Integer | 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.
}
begin
# List environments
result = api_instance.get_environments_by_project(project_key, opts)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->get_environments_by_project: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_environments_by_project_with_http_info(project_key, opts)
begin
# List environments
data, status_code, headers = api_instance.get_environments_by_project_with_http_info(project_key, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <Environments>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->get_environments_by_project_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
limit | Integer | The number of environments to return in the response. Defaults to 20. | [optional] |
offset | Integer | 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] |
- Content-Type: Not defined
- Accept: application/json
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. ### 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.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::EnvironmentsApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
patch_operation = [LaunchDarklyApi::PatchOperation.new({op: 'replace', path: '/exampleField'})] # Array<PatchOperation> |
begin
# Update environment
result = api_instance.patch_environment(project_key, environment_key, patch_operation)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->patch_environment: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> patch_environment_with_http_info(project_key, environment_key, patch_operation)
begin
# Update environment
data, status_code, headers = api_instance.patch_environment_with_http_info(project_key, environment_key, patch_operation)
p status_code # => 2xx
p headers # => { ... }
p data # => <Environment>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->patch_environment_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key | |
patch_operation | Array<PatchOperation> |
- Content-Type: application/json
- Accept: application/json
post_environment(project_key, environment_post)
Create environment
Approval settings > > The
approvalSettings
key 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.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::EnvironmentsApi.new
project_key = 'project_key_example' # String | The project key
environment_post = LaunchDarklyApi::EnvironmentPost.new({name: 'My Environment', key: 'environment-key-123abc', color: 'F5A623'}) # EnvironmentPost |
begin
# Create environment
result = api_instance.post_environment(project_key, environment_post)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->post_environment: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> post_environment_with_http_info(project_key, environment_post)
begin
# Create environment
data, status_code, headers = api_instance.post_environment_with_http_info(project_key, environment_post)
p status_code # => 2xx
p headers # => { ... }
p data # => <Environment>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->post_environment_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_post | EnvironmentPost |
- Content-Type: application/json
- Accept: application/json
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.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::EnvironmentsApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
begin
# Reset environment mobile SDK key
result = api_instance.reset_environment_mobile_key(project_key, environment_key)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->reset_environment_mobile_key: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> reset_environment_mobile_key_with_http_info(project_key, environment_key)
begin
# Reset environment mobile SDK key
data, status_code, headers = api_instance.reset_environment_mobile_key_with_http_info(project_key, environment_key)
p status_code # => 2xx
p headers # => { ... }
p data # => <Environment>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->reset_environment_mobile_key_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key |
- Content-Type: Not defined
- Accept: application/json
reset_environment_sdk_key(project_key, environment_key, opts)
Reset environment SDK key
Reset an environment's SDK key with an optional expiry time for the old key.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::EnvironmentsApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
opts = {
expiry: 789 # Integer | 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.
}
begin
# Reset environment SDK key
result = api_instance.reset_environment_sdk_key(project_key, environment_key, opts)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->reset_environment_sdk_key: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> reset_environment_sdk_key_with_http_info(project_key, environment_key, opts)
begin
# Reset environment SDK key
data, status_code, headers = api_instance.reset_environment_sdk_key_with_http_info(project_key, environment_key, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <Environment>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling EnvironmentsApi->reset_environment_sdk_key_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key | |
expiry | Integer | 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