Skip to content

Files

Latest commit

e44d477 · Apr 4, 2025

History

History
717 lines (525 loc) · 32.2 KB

ExperimentsApi.md

File metadata and controls

717 lines (525 loc) · 32.2 KB

LaunchDarklyApi::ExperimentsApi

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 (Deprecated)
get_experiment_results_for_metric_group GET /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey}/metric-groups/{metricGroupKey}/results Get experiment results for metric group (Deprecated)
get_experimentation_settings GET /api/v2/projects/{projectKey}/experimentation-settings Get experimentation settings
get_experiments GET /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments Get experiments
patch_experiment PATCH /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey} Patch experiment
put_experimentation_settings PUT /api/v2/projects/{projectKey}/experimentation-settings Update experimentation settings

create_experiment

create_experiment(project_key, environment_key, experiment_post)

Create experiment

Create an experiment. To run this experiment, you'll need to create an iteration and then update the experiment with the startIteration instruction. To learn more, read Creating experiments.

Examples

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::ExperimentsApi.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: 'Example experiment', key: 'experiment-key-123abc', iteration: LaunchDarklyApi::IterationInput.new({hypothesis: 'Example hypothesis, the new button placement will increase conversion', metrics: [LaunchDarklyApi::MetricInput.new({key: 'metric-key-123abc'})], treatments: [LaunchDarklyApi::TreatmentInput.new({name: 'Treatment 1', baseline: true, allocation_percent: '10', parameters: [LaunchDarklyApi::TreatmentParameterInput.new({flag_key: 'example-flag-for-experiment', variation_id: 'e432f62b-55f6-49dd-a02f-eb24acf39d05'})]})], flags: { key: LaunchDarklyApi::FlagInput.new({rule_id: 'e432f62b-55f6-49dd-a02f-eb24acf39d05', flag_config_version: 12})}})}) # 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 ExperimentsApi->create_experiment: #{e}"
end

Using the create_experiment_with_http_info variant

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 ExperimentsApi->create_experiment_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
project_key String The project key
environment_key String The environment key
experiment_post ExperimentPost

Return type

Experiment

Authorization

ApiKey

HTTP request headers

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

create_iteration

create_iteration(project_key, environment_key, experiment_key, iteration_input)

Create iteration

Create an experiment iteration. Experiment iterations let you record experiments in individual blocks of time. Initially, iterations are created with a status of not_started and appear in the draftIteration field of an experiment. To start or stop an iteration, update the experiment with the startIteration or stopIteration instruction. To learn more, read Start experiment iterations.

Examples

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::ExperimentsApi.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: 'Example hypothesis, the new button placement will increase conversion', metrics: [LaunchDarklyApi::MetricInput.new({key: 'metric-key-123abc'})], treatments: [LaunchDarklyApi::TreatmentInput.new({name: 'Treatment 1', baseline: true, allocation_percent: '10', parameters: [LaunchDarklyApi::TreatmentParameterInput.new({flag_key: 'example-flag-for-experiment', variation_id: 'e432f62b-55f6-49dd-a02f-eb24acf39d05'})]})], flags: { key: LaunchDarklyApi::FlagInput.new({rule_id: 'e432f62b-55f6-49dd-a02f-eb24acf39d05', flag_config_version: 12})}}) # 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 ExperimentsApi->create_iteration: #{e}"
end

Using the create_iteration_with_http_info variant

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 ExperimentsApi->create_iteration_with_http_info: #{e}"
end

Parameters

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

Return type

IterationRep

Authorization

ApiKey

HTTP request headers

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

get_experiment

get_experiment(project_key, environment_key, experiment_key, opts)

Get experiment

Get details about an experiment. ### Expanding the experiment response LaunchDarkly supports four fields for expanding the "Get experiment" 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 is included in the response. - draftIteration includes the 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 is not included in the response. For example, expand=draftIteration,treatments includes the draftIteration and treatments fields in the response. If fields that you request with the expand query parameter are empty, they are not included in the response.

Examples

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::ExperimentsApi.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
opts = {
  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 experiment
  result = api_instance.get_experiment(project_key, environment_key, experiment_key, opts)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->get_experiment: #{e}"
end

Using the get_experiment_with_http_info variant

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, opts)

begin
  # Get experiment
  data, status_code, headers = api_instance.get_experiment_with_http_info(project_key, environment_key, experiment_key, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <Experiment>
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->get_experiment_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
project_key String The project key
environment_key String The environment key
experiment_key String The experiment key
expand String A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above. [optional]

Return type

Experiment

Authorization

ApiKey

HTTP request headers

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

get_experiment_results

get_experiment_results(project_key, environment_key, experiment_key, metric_key, opts)

Get experiment results (Deprecated)

Get results from an experiment for a particular metric. LaunchDarkly supports one field for expanding the "Get experiment results" response. By default, this field is not included in the response. To expand the response, append the expand query parameter with the following field: * traffic includes the total count of units for each treatment. For example, expand=traffic includes the traffic field for the project in the response.

Examples

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::ExperimentsApi.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
opts = {
  iteration_id: 'iteration_id_example', # String | The iteration ID
  expand: 'expand_example' # String | A comma-separated list of fields to expand in the response. Supported fields are explained above.
}

begin
  # Get experiment results (Deprecated)
  result = api_instance.get_experiment_results(project_key, environment_key, experiment_key, metric_key, opts)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->get_experiment_results: #{e}"
end

Using the get_experiment_results_with_http_info variant

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, opts)

begin
  # Get experiment results (Deprecated)
  data, status_code, headers = api_instance.get_experiment_results_with_http_info(project_key, environment_key, experiment_key, metric_key, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <ExperimentBayesianResultsRep>
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->get_experiment_results_with_http_info: #{e}"
end

Parameters

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
iteration_id String The iteration ID [optional]
expand String A comma-separated list of fields to expand in the response. Supported fields are explained above. [optional]

Return type

ExperimentBayesianResultsRep

Authorization

ApiKey

HTTP request headers

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

get_experiment_results_for_metric_group

get_experiment_results_for_metric_group(project_key, environment_key, experiment_key, metric_group_key, opts)

Get experiment results for metric group (Deprecated)

Get results from an experiment for a particular metric group.

Examples

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::ExperimentsApi.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_group_key = 'metric_group_key_example' # String | The metric group key
opts = {
  iteration_id: 'iteration_id_example' # String | The iteration ID
}

begin
  # Get experiment results for metric group (Deprecated)
  result = api_instance.get_experiment_results_for_metric_group(project_key, environment_key, experiment_key, metric_group_key, opts)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->get_experiment_results_for_metric_group: #{e}"
end

Using the get_experiment_results_for_metric_group_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_experiment_results_for_metric_group_with_http_info(project_key, environment_key, experiment_key, metric_group_key, opts)

begin
  # Get experiment results for metric group (Deprecated)
  data, status_code, headers = api_instance.get_experiment_results_for_metric_group_with_http_info(project_key, environment_key, experiment_key, metric_group_key, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <MetricGroupResultsRep>
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->get_experiment_results_for_metric_group_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
project_key String The project key
environment_key String The environment key
experiment_key String The experiment key
metric_group_key String The metric group key
iteration_id String The iteration ID [optional]

Return type

MetricGroupResultsRep

Authorization

ApiKey

HTTP request headers

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

get_experimentation_settings

get_experimentation_settings(project_key)

Get experimentation settings

Get current experimentation settings for the given project

Examples

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::ExperimentsApi.new
project_key = 'project_key_example' # String | The project key

begin
  # Get experimentation settings
  result = api_instance.get_experimentation_settings(project_key)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->get_experimentation_settings: #{e}"
end

Using the get_experimentation_settings_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_experimentation_settings_with_http_info(project_key)

begin
  # Get experimentation settings
  data, status_code, headers = api_instance.get_experimentation_settings_with_http_info(project_key)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <RandomizationSettingsRep>
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->get_experimentation_settings_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
project_key String The project key

Return type

RandomizationSettingsRep

Authorization

ApiKey

HTTP request headers

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

get_experiments

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 "Get 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 is included in the response. - draftIteration includes the 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 is not included in the response. For example, expand=draftIteration,treatments includes the draftIteration and treatments fields in the response. If fields that you request with the expand query parameter are empty, they are not included in the response.

Examples

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::ExperimentsApi.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.
  lifecycle_state: 'lifecycle_state_example' # String | A comma-separated list of experiment archived states. Supports `archived`, `active`, or both. Defaults to `active` experiments.
}

begin
  # Get experiments
  result = api_instance.get_experiments(project_key, environment_key, opts)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->get_experiments: #{e}"
end

Using the get_experiments_with_http_info variant

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 ExperimentsApi->get_experiments_with_http_info: #{e}"
end

Parameters

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]
lifecycle_state String A comma-separated list of experiment archived states. Supports `archived`, `active`, or both. Defaults to `active` experiments. [optional]

Return type

ExperimentCollectionRep

Authorization

ApiKey

HTTP request headers

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

patch_experiment

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. Here's an example: json { \"instructions\": [{ \"kind\": \"updateName\", \"value\": \"Example updated experiment name\" }] } #### updateDescription Updates the experiment description. ##### Parameters - value: The new description. Here's an example: json { \"instructions\": [{ \"kind\": \"updateDescription\", \"value\": \"Example updated description\" }] } #### startIteration Starts a new iteration for this experiment. You must create a new iteration before calling this instruction. An iteration may not be started until it meets the following criteria: * Its associated flag is toggled on and is not archived * Its randomizationUnit is set * At least one of its treatments has a non-zero allocationPercent ##### Parameters - changeJustification: The reason for starting a new iteration. Required when you call startIteration on an already running experiment, otherwise optional. Here's an example: json { \"instructions\": [{ \"kind\": \"startIteration\", \"changeJustification\": \"It's time to start a new iteration\" }] } #### stopIteration Stops the current iteration for this experiment. ##### Parameters - winningTreatmentId: The ID of the winning treatment. Treatment IDs are returned as part of the Get experiment response. They are the _id of each element in the treatments array. - winningReason: The reason for the winner Here's an example: json { \"instructions\": [{ \"kind\": \"stopIteration\", \"winningTreatmentId\": \"3a548ec2-72ac-4e59-8518-5c24f5609ccf\", \"winningReason\": \"Example reason to stop the iteration\" }] } #### archiveExperiment Archives this experiment. Archived experiments are hidden by default in the LaunchDarkly user interface. You cannot start new iterations for archived experiments. Here's an example: json { \"instructions\": [{ \"kind\": \"archiveExperiment\" }] } #### restoreExperiment Restores an archived experiment. After restoring an experiment, you can start new iterations for it again. Here's an example: json { \"instructions\": [{ \"kind\": \"restoreExperiment\" }] }

Examples

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::ExperimentsApi.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 ExperimentsApi->patch_experiment: #{e}"
end

Using the patch_experiment_with_http_info variant

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 ExperimentsApi->patch_experiment_with_http_info: #{e}"
end

Parameters

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

Return type

Experiment

Authorization

ApiKey

HTTP request headers

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

put_experimentation_settings

put_experimentation_settings(project_key, randomization_settings_put)

Update experimentation settings

Update experimentation settings for the given project

Examples

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::ExperimentsApi.new
project_key = 'project_key_example' # String | The project key
randomization_settings_put = LaunchDarklyApi::RandomizationSettingsPut.new({randomization_units: [LaunchDarklyApi::RandomizationUnitInput.new({randomization_unit: 'user', standard_randomization_unit: 'guest'})]}) # RandomizationSettingsPut | 

begin
  # Update experimentation settings
  result = api_instance.put_experimentation_settings(project_key, randomization_settings_put)
  p result
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->put_experimentation_settings: #{e}"
end

Using the put_experimentation_settings_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> put_experimentation_settings_with_http_info(project_key, randomization_settings_put)

begin
  # Update experimentation settings
  data, status_code, headers = api_instance.put_experimentation_settings_with_http_info(project_key, randomization_settings_put)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <RandomizationSettingsRep>
rescue LaunchDarklyApi::ApiError => e
  puts "Error when calling ExperimentsApi->put_experimentation_settings_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
project_key String The project key
randomization_settings_put RandomizationSettingsPut

Return type

RandomizationSettingsRep

Authorization

ApiKey

HTTP request headers

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