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:
{
"instructions": [{
"kind": "updateName",
"value": "Example updated experiment name"
}]
}
updateDescription
Updates the experiment description.
Parameters
- value: The new description.
Here's an example:
{
"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:
{
"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:
{
"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:
{
"instructions": [{ "kind": "archiveExperiment" }]
}
restoreExperiment
Restores an archived experiment. After restoring an experiment, you can start new iterations for it again.
Here's an example:
{
"instructions": [{ "kind": "restoreExperiment" }]
}
Path parameters
The project key
The project key
The environment key
The environment key
The experiment key
The experiment key
Request body
Example request
{
"comment": "Optional comment"
}Response
Experiment response
Example response
{
"_id": "12ab3c45de678910fgh12345",
"key": "experiment-key-123abc",
"name": "Example experiment",
"description": "An example experiment, used in testing",
"_maintainerId": "12ab3c45de678910fgh12345",
"tags": [
"experiment",
"feature"
],
"_links": {
"parent": {
"href": "/api/v2/projects/my-project/environments/my-environment",
"type": "application/json"
},
"self": {
"href": "/api/v2/projects/my-project/environments/my-environment/experiments/my-experiment",
"type": "application/json"
}
},
"holdoutId": "f3b74309-d581-44e1-8a2b-bb2933b4fe40",
"currentIteration": {
"_id": "12ab3c45de678910fgh12345",
"hypothesis": "The new button placement will increase conversion",
"status": "running",
"winningTreatmentId": "122c9f3e-da26-4321-ba68-e0fc02eced58",
"winningReason": "We ran this iteration for two weeks and the winning variation was clear",
"canReshuffleTraffic": true,
"reallocationFrequencyMillis": 3600000,
"primaryMetric": {
"key": "metric-key-123abc",
"name": "My metric",
"kind": "custom",
"isNumeric": true,
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
},
"primarySingleMetric": {
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
}
},
"primaryFunnel": {
"key": "metric-group-key-123abc",
"name": "My metric group",
"kind": "funnel",
"_links": {
"parent": {
"href": "/api/v2/projects/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/projects/my-project/metric-groups/my-metric-group",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
},
"randomizationUnit": "user",
"treatments": [
{
"_id": "122c9f3e-da26-4321-ba68-e0fc02eced58",
"name": "Treatment 1",
"allocationPercent": "10",
"baseline": true
}
],
"secondaryMetrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
}
}
],
"metrics": [
{
"key": "metric-key-123abc",
"name": "My metric",
"kind": "custom",
"isNumeric": true,
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
}
],
"layerSnapshot": {
"key": "checkout-flow",
"name": "Checkout Flow",
"reservationPercent": 10,
"otherReservationPercent": 70
}
},
"draftIteration": {
"_id": "12ab3c45de678910fgh12345",
"hypothesis": "The new button placement will increase conversion",
"status": "running",
"winningTreatmentId": "122c9f3e-da26-4321-ba68-e0fc02eced58",
"winningReason": "We ran this iteration for two weeks and the winning variation was clear",
"canReshuffleTraffic": true,
"reallocationFrequencyMillis": 3600000,
"primaryMetric": {
"key": "metric-key-123abc",
"name": "My metric",
"kind": "custom",
"isNumeric": true,
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
},
"primarySingleMetric": {
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
}
},
"primaryFunnel": {
"key": "metric-group-key-123abc",
"name": "My metric group",
"kind": "funnel",
"_links": {
"parent": {
"href": "/api/v2/projects/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/projects/my-project/metric-groups/my-metric-group",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
},
"randomizationUnit": "user",
"treatments": [
{
"_id": "122c9f3e-da26-4321-ba68-e0fc02eced58",
"name": "Treatment 1",
"allocationPercent": "10",
"baseline": true
}
],
"secondaryMetrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
}
}
],
"metrics": [
{
"key": "metric-key-123abc",
"name": "My metric",
"kind": "custom",
"isNumeric": true,
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
}
],
"layerSnapshot": {
"key": "checkout-flow",
"name": "Checkout Flow",
"reservationPercent": 10,
"otherReservationPercent": 70
}
},
"previousIterations": [
{
"_id": "12ab3c45de678910fgh12345",
"hypothesis": "The new button placement will increase conversion",
"status": "running",
"winningTreatmentId": "122c9f3e-da26-4321-ba68-e0fc02eced58",
"winningReason": "We ran this iteration for two weeks and the winning variation was clear",
"canReshuffleTraffic": true,
"reallocationFrequencyMillis": 3600000,
"primaryMetric": {
"key": "metric-key-123abc",
"name": "My metric",
"kind": "custom",
"isNumeric": true,
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
},
"primarySingleMetric": {
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
}
},
"primaryFunnel": {
"key": "metric-group-key-123abc",
"name": "My metric group",
"kind": "funnel",
"_links": {
"parent": {
"href": "/api/v2/projects/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/projects/my-project/metric-groups/my-metric-group",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
},
"randomizationUnit": "user",
"treatments": [
{
"_id": "122c9f3e-da26-4321-ba68-e0fc02eced58",
"name": "Treatment 1",
"allocationPercent": "10",
"baseline": true
}
],
"secondaryMetrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
}
}
],
"metrics": [
{
"key": "metric-key-123abc",
"name": "My metric",
"kind": "custom",
"isNumeric": true,
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"metrics": [
{
"key": "metric-key-123abc",
"_versionId": "version-id-123abc",
"name": "Example metric",
"kind": "custom",
"isNumeric": true,
"unitAggregationType": "sum",
"eventKey": "event-key-123abc",
"_links": {
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"nameInGroup": "Step 1",
"randomizationUnits": [
"user"
]
}
]
}
],
"layerSnapshot": {
"key": "checkout-flow",
"name": "Checkout Flow",
"reservationPercent": 10,
"otherReservationPercent": 70
}
}
]
}