All URIs are relative to https://app.launchdarkly.com
Method | HTTP request | Description |
---|---|---|
create_experiment | POST /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments | Create experiment |
create_iteration | POST /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey}/iterations | Create iteration |
get_experiment | GET /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey} | Get experiment |
get_experiment_results | GET /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey}/metrics/{metricKey}/results | Get experiment results |
get_experiments | GET /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments | Get experiments |
get_legacy_experiment_results | GET /api/v2/flags/{projectKey}/{featureFlagKey}/experiments/{environmentKey}/{metricKey} | Get legacy experiment results (deprecated) |
patch_experiment | PATCH /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey} | Patch experiment |
reset_experiment | DELETE /api/v2/flags/{projectKey}/{featureFlagKey}/experiments/{environmentKey}/{metricKey}/results | Reset experiment results |
create_experiment(project_key, environment_key, experiment_post)
Create experiment
Create an experiment. To learn more, read Creating experiments.
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::ExperimentsBetaApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
experiment_post = LaunchDarklyApi::ExperimentPost.new({name: 'name_example', maintainer_id: 'maintainer_id_example', key: 'key_example', iteration: LaunchDarklyApi::IterationInput.new({hypothesis: 'hypothesis_example', metrics: [LaunchDarklyApi::MetricInput.new({key: 'key_example', primary: false})], treatments: [LaunchDarklyApi::TreatmentInput.new({name: 'name_example', baseline: false, allocation_percent: 'allocation_percent_example', parameters: [LaunchDarklyApi::TreatmentParameterInput.new({flag_key: 'flag_key_example', variation_id: 'variation_id_example'})]})], flags: { key: LaunchDarklyApi::FlagInput.new({rule_id: 'rule_id_example', flag_config_version: 37})}})}) # ExperimentPost |
begin
# Create experiment
result = api_instance.create_experiment(project_key, environment_key, experiment_post)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->create_experiment: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> create_experiment_with_http_info(project_key, environment_key, experiment_post)
begin
# Create experiment
data, status_code, headers = api_instance.create_experiment_with_http_info(project_key, environment_key, experiment_post)
p status_code # => 2xx
p headers # => { ... }
p data # => <Experiment>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->create_experiment_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key | |
experiment_post | ExperimentPost |
- Content-Type: application/json
- Accept: application/json
create_iteration(project_key, environment_key, experiment_key, iteration_input)
Create iteration
Create an experiment iteration. Experiment iterations let you record experiments in discrete blocks of time. To learn more, read Starting experiment iterations.
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::ExperimentsBetaApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
experiment_key = 'experiment_key_example' # String | The experiment key
iteration_input = LaunchDarklyApi::IterationInput.new({hypothesis: 'hypothesis_example', metrics: [LaunchDarklyApi::MetricInput.new({key: 'key_example', primary: false})], treatments: [LaunchDarklyApi::TreatmentInput.new({name: 'name_example', baseline: false, allocation_percent: 'allocation_percent_example', parameters: [LaunchDarklyApi::TreatmentParameterInput.new({flag_key: 'flag_key_example', variation_id: 'variation_id_example'})]})], flags: { key: LaunchDarklyApi::FlagInput.new({rule_id: 'rule_id_example', flag_config_version: 37})}}) # IterationInput |
begin
# Create iteration
result = api_instance.create_iteration(project_key, environment_key, experiment_key, iteration_input)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->create_iteration: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> create_iteration_with_http_info(project_key, environment_key, experiment_key, iteration_input)
begin
# Create iteration
data, status_code, headers = api_instance.create_iteration_with_http_info(project_key, environment_key, experiment_key, iteration_input)
p status_code # => 2xx
p headers # => { ... }
p data # => <IterationRep>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->create_iteration_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key | |
experiment_key | String | The experiment key | |
iteration_input | IterationInput |
- Content-Type: application/json
- Accept: application/json
get_experiment(project_key, environment_key, experiment_key)
Get experiment
Get details about an experiment.
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::ExperimentsBetaApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
experiment_key = 'experiment_key_example' # String | The experiment key
begin
# Get experiment
result = api_instance.get_experiment(project_key, environment_key, experiment_key)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->get_experiment: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_experiment_with_http_info(project_key, environment_key, experiment_key)
begin
# Get experiment
data, status_code, headers = api_instance.get_experiment_with_http_info(project_key, environment_key, experiment_key)
p status_code # => 2xx
p headers # => { ... }
p data # => <Experiment>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->get_experiment_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key | |
experiment_key | String | The experiment key |
- Content-Type: Not defined
- Accept: application/json
get_experiment_results(project_key, environment_key, experiment_key, metric_key)
Get experiment results
Get results from an experiment for a particular metric.
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::ExperimentsBetaApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
experiment_key = 'experiment_key_example' # String | The experiment key
metric_key = 'metric_key_example' # String | The metric key
begin
# Get experiment results
result = api_instance.get_experiment_results(project_key, environment_key, experiment_key, metric_key)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->get_experiment_results: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_experiment_results_with_http_info(project_key, environment_key, experiment_key, metric_key)
begin
# Get experiment results
data, status_code, headers = api_instance.get_experiment_results_with_http_info(project_key, environment_key, experiment_key, metric_key)
p status_code # => 2xx
p headers # => { ... }
p data # => <ExperimentBayesianResultsRep>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->get_experiment_results_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key | |
experiment_key | String | The experiment key | |
metric_key | String | The metric key |
- Content-Type: Not defined
- Accept: application/json
get_experiments(project_key, environment_key, opts)
Get experiments
Get details about all experiments in an environment. ### Filtering experiments LaunchDarkly supports the filter
query param for filtering, with the following fields: - flagKey
filters for only experiments that use the flag with the given key. - metricKey
filters for only experiments that use the metric with the given key. - status
filters for only experiments with an iteration with the given status. An iteration can have the status not_started
, running
or stopped
. For example, filter=flagKey:my-flag,status:running,metricKey:page-load-ms
filters for experiments for the given flag key and the given metric key which have a currently running iteration. ### Expanding the experiments response LaunchDarkly supports four fields for expanding the "List experiments" response. By default, these fields are not included in the response. To expand the response, append the expand
query parameter and add a comma-separated list with any of the following fields: - previousIterations
includes all iterations prior to the current iteration. By default only the current iteration will be included in the response. - draftIteration
includes a draft of an iteration which has not been started yet, if any. - secondaryMetrics
includes secondary metrics. By default only the primary metric is included in the response. - treatments
includes all treatment and parameter details. By default treatment data will not be included in the response. For example, expand=draftIteration,treatments
includes the draftIteration
and treatments
fields in the response.
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::ExperimentsBetaApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
opts = {
limit: 789, # Integer | The maximum number of experiments to return. Defaults to 20
offset: 789, # Integer | Where to start in the list. Use this 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`. Supported fields are explained above.
expand: 'expand_example' # String | A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above.
}
begin
# Get experiments
result = api_instance.get_experiments(project_key, environment_key, opts)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->get_experiments: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_experiments_with_http_info(project_key, environment_key, opts)
begin
# Get experiments
data, status_code, headers = api_instance.get_experiments_with_http_info(project_key, environment_key, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <ExperimentCollectionRep>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->get_experiments_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key | |
limit | Integer | The maximum number of experiments to return. Defaults to 20 | [optional] |
offset | Integer | Where to start in the list. Use this 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`. Supported fields are explained above. | [optional] |
expand | String | A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above. | [optional] |
- Content-Type: Not defined
- Accept: application/json
get_legacy_experiment_results(project_key, feature_flag_key, environment_key, metric_key, opts)
Get legacy experiment results (deprecated)
Get detailed experiment result data for legacy experiments.
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::ExperimentsBetaApi.new
project_key = 'project_key_example' # String | The project key
feature_flag_key = 'feature_flag_key_example' # String | The feature flag key
environment_key = 'environment_key_example' # String | The environment key
metric_key = 'metric_key_example' # String | The metric key
opts = {
from: 789, # Integer | A timestamp denoting the start of the data collection period, expressed as a Unix epoch time in milliseconds.
to: 789 # Integer | A timestamp denoting the end of the data collection period, expressed as a Unix epoch time in milliseconds.
}
begin
# Get legacy experiment results (deprecated)
result = api_instance.get_legacy_experiment_results(project_key, feature_flag_key, environment_key, metric_key, opts)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->get_legacy_experiment_results: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_legacy_experiment_results_with_http_info(project_key, feature_flag_key, environment_key, metric_key, opts)
begin
# Get legacy experiment results (deprecated)
data, status_code, headers = api_instance.get_legacy_experiment_results_with_http_info(project_key, feature_flag_key, environment_key, metric_key, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <ExperimentResults>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->get_legacy_experiment_results_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
feature_flag_key | String | The feature flag key | |
environment_key | String | The environment key | |
metric_key | String | The metric key | |
from | Integer | A timestamp denoting the start of the data collection period, expressed as a Unix epoch time in milliseconds. | [optional] |
to | Integer | A timestamp denoting the end of the data collection period, expressed as a Unix epoch time in milliseconds. | [optional] |
- Content-Type: Not defined
- Accept: application/json
patch_experiment(project_key, environment_key, experiment_key, experiment_patch_input)
Patch experiment
Update an experiment. Updating an experiment 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 experiments. #### updateName Updates the experiment name. ##### Parameters - value
: The new name. #### updateDescription Updates the experiment description. ##### Parameters - value
: The new description. #### startIteration Starts a new iteration for this experiment. #### stopIteration Stops the current iteration for this experiment.
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::ExperimentsBetaApi.new
project_key = 'project_key_example' # String | The project key
environment_key = 'environment_key_example' # String | The environment key
experiment_key = 'experiment_key_example' # String | The experiment key
experiment_patch_input = LaunchDarklyApi::ExperimentPatchInput.new({instructions: [{ key: 3.56}]}) # ExperimentPatchInput |
begin
# Patch experiment
result = api_instance.patch_experiment(project_key, environment_key, experiment_key, experiment_patch_input)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->patch_experiment: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> patch_experiment_with_http_info(project_key, environment_key, experiment_key, experiment_patch_input)
begin
# Patch experiment
data, status_code, headers = api_instance.patch_experiment_with_http_info(project_key, environment_key, experiment_key, experiment_patch_input)
p status_code # => 2xx
p headers # => { ... }
p data # => <Experiment>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->patch_experiment_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
environment_key | String | The environment key | |
experiment_key | String | The experiment key | |
experiment_patch_input | ExperimentPatchInput |
- Content-Type: application/json
- Accept: application/json
reset_experiment(project_key, feature_flag_key, environment_key, metric_key)
Reset experiment results
Reset all experiment results by deleting all existing data for an experiment.
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::ExperimentsBetaApi.new
project_key = 'project_key_example' # String | The project key
feature_flag_key = 'feature_flag_key_example' # String | The feature flag key
environment_key = 'environment_key_example' # String | The environment key
metric_key = 'metric_key_example' # String | The metric's key
begin
# Reset experiment results
api_instance.reset_experiment(project_key, feature_flag_key, environment_key, metric_key)
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->reset_experiment: #{e}"
end
This returns an Array which contains the response data (nil
in this case), status code and headers.
<Array(nil, Integer, Hash)> reset_experiment_with_http_info(project_key, feature_flag_key, environment_key, metric_key)
begin
# Reset experiment results
data, status_code, headers = api_instance.reset_experiment_with_http_info(project_key, feature_flag_key, environment_key, metric_key)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling ExperimentsBetaApi->reset_experiment_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
feature_flag_key | String | The feature flag key | |
environment_key | String | The environment key | |
metric_key | String | The metric's key |
nil (empty response body)
- Content-Type: Not defined
- Accept: application/json