All URIs are relative to https://app.launchdarkly.com
| Method | HTTP request | Description |
|---|---|---|
| CreateExperiment | Post /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments | Create experiment |
| CreateIteration | Post /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey}/iterations | Create iteration |
| GetExperiment | Get /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey} | Get experiment |
| GetExperimentationSettings | Get /api/v2/projects/{projectKey}/experimentation-settings | Get experimentation settings |
| GetExperiments | Get /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments | Get experiments |
| PatchExperiment | Patch /api/v2/projects/{projectKey}/environments/{environmentKey}/experiments/{experimentKey} | Patch experiment |
| PutExperimentationSettings | Put /api/v2/projects/{projectKey}/experimentation-settings | Update experimentation settings |
Experiment CreateExperiment(ctx, projectKey, environmentKey).ExperimentPost(experimentPost).Execute()
Create experiment
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
projectKey := "projectKey_example" // string | The project key
environmentKey := "environmentKey_example" // string | The environment key
experimentPost := *openapiclient.NewExperimentPost("Example experiment", "experiment-key-123abc", *openapiclient.NewIterationInput("Example hypothesis, the new button placement will increase conversion", []openapiclient.MetricInput{*openapiclient.NewMetricInput("metric-key-123abc")}, []openapiclient.TreatmentInput{*openapiclient.NewTreatmentInput("Treatment 1", true, "10", []openapiclient.TreatmentParameterInput{*openapiclient.NewTreatmentParameterInput("example-flag-for-experiment", "e432f62b-55f6-49dd-a02f-eb24acf39d05")})}, map[string]FlagInput{"key": *openapiclient.NewFlagInput("e432f62b-55f6-49dd-a02f-eb24acf39d05", int32(12))})) // ExperimentPost |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.ExperimentsApi.CreateExperiment(context.Background(), projectKey, environmentKey).ExperimentPost(experimentPost).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ExperimentsApi.CreateExperiment``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateExperiment`: Experiment
fmt.Fprintf(os.Stdout, "Response from `ExperimentsApi.CreateExperiment`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| projectKey | string | The project key | |
| environmentKey | string | The environment key |
Other parameters are passed through a pointer to a apiCreateExperimentRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
experimentPost | ExperimentPost | |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
IterationRep CreateIteration(ctx, projectKey, environmentKey, experimentKey).IterationInput(iterationInput).Execute()
Create iteration
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
projectKey := "projectKey_example" // string | The project key
environmentKey := "environmentKey_example" // string | The environment key
experimentKey := "experimentKey_example" // string | The experiment key
iterationInput := *openapiclient.NewIterationInput("Example hypothesis, the new button placement will increase conversion", []openapiclient.MetricInput{*openapiclient.NewMetricInput("metric-key-123abc")}, []openapiclient.TreatmentInput{*openapiclient.NewTreatmentInput("Treatment 1", true, "10", []openapiclient.TreatmentParameterInput{*openapiclient.NewTreatmentParameterInput("example-flag-for-experiment", "e432f62b-55f6-49dd-a02f-eb24acf39d05")})}, map[string]FlagInput{"key": *openapiclient.NewFlagInput("e432f62b-55f6-49dd-a02f-eb24acf39d05", int32(12))}) // IterationInput |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.ExperimentsApi.CreateIteration(context.Background(), projectKey, environmentKey, experimentKey).IterationInput(iterationInput).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ExperimentsApi.CreateIteration``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateIteration`: IterationRep
fmt.Fprintf(os.Stdout, "Response from `ExperimentsApi.CreateIteration`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| projectKey | string | The project key | |
| environmentKey | string | The environment key | |
| experimentKey | string | The experiment key |
Other parameters are passed through a pointer to a apiCreateIterationRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
iterationInput | IterationInput | |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Experiment GetExperiment(ctx, projectKey, environmentKey, experimentKey).Expand(expand).Execute()
Get experiment
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
projectKey := "projectKey_example" // string | The project key
environmentKey := "environmentKey_example" // string | The environment key
experimentKey := "experimentKey_example" // string | The experiment key
expand := "expand_example" // string | A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above. (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.ExperimentsApi.GetExperiment(context.Background(), projectKey, environmentKey, experimentKey).Expand(expand).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ExperimentsApi.GetExperiment``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetExperiment`: Experiment
fmt.Fprintf(os.Stdout, "Response from `ExperimentsApi.GetExperiment`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| projectKey | string | The project key | |
| environmentKey | string | The environment key | |
| experimentKey | string | The experiment key |
Other parameters are passed through a pointer to a apiGetExperimentRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
expand | string | A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above. |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RandomizationSettingsRep GetExperimentationSettings(ctx, projectKey).Execute()
Get experimentation settings
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
projectKey := "projectKey_example" // string | The project key
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.ExperimentsApi.GetExperimentationSettings(context.Background(), projectKey).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ExperimentsApi.GetExperimentationSettings``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetExperimentationSettings`: RandomizationSettingsRep
fmt.Fprintf(os.Stdout, "Response from `ExperimentsApi.GetExperimentationSettings`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| projectKey | string | The project key |
Other parameters are passed through a pointer to a apiGetExperimentationSettingsRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ExperimentCollectionRep GetExperiments(ctx, projectKey, environmentKey).Limit(limit).Offset(offset).Filter(filter).Expand(expand).LifecycleState(lifecycleState).Execute()
Get experiments
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
projectKey := "projectKey_example" // string | The project key
environmentKey := "environmentKey_example" // string | The environment key
limit := int64(789) // int64 | The maximum number of experiments to return. Defaults to 20. (optional)
offset := int64(789) // int64 | 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 := "filter_example" // string | A comma-separated list of filters. Each filter is of the form `field:value`. Supported fields are explained above. (optional)
expand := "expand_example" // string | A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above. (optional)
lifecycleState := "lifecycleState_example" // string | A comma-separated list of experiment archived states. Supports `archived`, `active`, or both. Defaults to `active` experiments. (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.ExperimentsApi.GetExperiments(context.Background(), projectKey, environmentKey).Limit(limit).Offset(offset).Filter(filter).Expand(expand).LifecycleState(lifecycleState).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ExperimentsApi.GetExperiments``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetExperiments`: ExperimentCollectionRep
fmt.Fprintf(os.Stdout, "Response from `ExperimentsApi.GetExperiments`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| projectKey | string | The project key | |
| environmentKey | string | The environment key |
Other parameters are passed through a pointer to a apiGetExperimentsRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
limit | int64 | The maximum number of experiments to return. Defaults to 20. | offset | int64 | 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 | string | A comma-separated list of filters. Each filter is of the form `field:value`. Supported fields are explained above. | expand | string | A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above. | lifecycleState | string | A comma-separated list of experiment archived states. Supports `archived`, `active`, or both. Defaults to `active` experiments. |
- Content-Type: Not defined
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Experiment PatchExperiment(ctx, projectKey, environmentKey, experimentKey).ExperimentPatchInput(experimentPatchInput).Execute()
Patch experiment
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
projectKey := "projectKey_example" // string | The project key
environmentKey := "environmentKey_example" // string | The environment key
experimentKey := "experimentKey_example" // string | The experiment key
experimentPatchInput := *openapiclient.NewExperimentPatchInput([]map[string]interface{}{map[string]interface{}{"key": interface{}(123)}}) // ExperimentPatchInput |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.ExperimentsApi.PatchExperiment(context.Background(), projectKey, environmentKey, experimentKey).ExperimentPatchInput(experimentPatchInput).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ExperimentsApi.PatchExperiment``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PatchExperiment`: Experiment
fmt.Fprintf(os.Stdout, "Response from `ExperimentsApi.PatchExperiment`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| projectKey | string | The project key | |
| environmentKey | string | The environment key | |
| experimentKey | string | The experiment key |
Other parameters are passed through a pointer to a apiPatchExperimentRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
experimentPatchInput | ExperimentPatchInput | |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RandomizationSettingsRep PutExperimentationSettings(ctx, projectKey).RandomizationSettingsPut(randomizationSettingsPut).Execute()
Update experimentation settings
package main
import (
"context"
"fmt"
"os"
openapiclient "github.com/launchdarkly/api-client-go"
)
func main() {
projectKey := "projectKey_example" // string | The project key
randomizationSettingsPut := *openapiclient.NewRandomizationSettingsPut([]openapiclient.RandomizationUnitInput{*openapiclient.NewRandomizationUnitInput("user")}) // RandomizationSettingsPut |
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
resp, r, err := apiClient.ExperimentsApi.PutExperimentationSettings(context.Background(), projectKey).RandomizationSettingsPut(randomizationSettingsPut).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `ExperimentsApi.PutExperimentationSettings``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `PutExperimentationSettings`: RandomizationSettingsRep
fmt.Fprintf(os.Stdout, "Response from `ExperimentsApi.PutExperimentationSettings`: %v\n", resp)
}| Name | Type | Description | Notes |
|---|---|---|---|
| ctx | context.Context | context for authentication, logging, cancellation, deadlines, tracing, etc. | |
| projectKey | string | The project key |
Other parameters are passed through a pointer to a apiPutExperimentationSettingsRequest struct via the builder pattern
| Name | Type | Description | Notes |
|---|
randomizationSettingsPut | RandomizationSettingsPut | |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]