Update a cross-project Holdout
1 min
PATCH
https://api.optimizely.com/flags/v1//holdouts/{holdout_id}
Path Parameters
- holdout_idintegerrequired
Header Parameters
- acceptstringDescriptionDefaultapplication/jsonAllowedapplication/jsonapplication/problem+json
- If-MatchstringExampleDescriptionPattern^"revision-[0-9]+"$
Responses
200
- HoldoutExample
{ "archived": false, "audience_conditions": [ "or", { "audience_id": 5340810295 } ], "created_by_user_email": "[email protected]", "created_time": "2023-12-15T10:00:00.000Z", "description": "Holdout group to measure the overall impact of our growth experiments throughout the year", "environment_key": "production", "holdout_results_api_token": "SampleToken.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9", "id": 12345, "key": "annual_growth_holdout", "metrics": [ { "aggregator": "unique", "display_title": "Conversion Rate", "scope": "visitor", "winning_direction": "increasing" } ], "name": "Annual Growth Control Group", "project_id": 98765, "revision": 3, "scope": "global", "start_time": "2024-01-01T00:00:00.000Z", "status": "running", "traffic_allocation": 1000, "updated_time": "2024-01-01T10:00:00.000Z", "urn": "holdout.flag.optimizely.com::12345" }Description- archivedbooleanDescription
- audience_conditionsobject[]ExampleDescription
- audience_idsinteger[]Example
[ 5340810295, 1234567890 ]
Description - created_by_user_emailstringExampleDescription
- created_timestring<date-time>ExampleDescriptionFormatdate-time
- descriptionstringExampleDescriptionMax Length1000
- end_timestring<date-time>ExampleDescriptionFormatdate-time
- environment_keystringExampleDescription
- environment_namestringExampleDescription
- exclude_targeted_deliveriesbooleanDescriptionDefaultfalse
- holdout_results_api_tokenstringExampleDescription
- idintegerrequiredExampleDescription
- keystringrequiredExampleDescriptionMax Length64Pattern^[a-zA-Z0-9_\-]+$
- metricsMetric[]Description
- aggregatorstring<unique | count | sum | ratio>requiredDescriptionAlloweduniquecountsumratio
- display_titlestringDescription
- display_unitstringDescription
- event_idinteger<int64>ExampleDescriptionFormatint64
- event_propertiesobject
- filterobject
- combine_operatorstring<or | and>Allowedorand
- conditionsEventPropertyCondition[]
- namestringrequired
- operatorstring<equal_to | not_equal_to | greater_than | greater_than_or_equal_to | less_than | less_than_or_equal_to | contains | does_not_contain>requiredAllowedequal_tonot_equal_togreater_thangreater_than_or_equal_toless_thanless_than_or_equal_tocontainsdoes_not_contain
- typestring<string | number | boolean>requiredAllowedstringnumberboolean
- valuestringrequired
- event_typestring
- fieldstring<revenue | value>DescriptionAllowedrevenuevalue
- idstringDescription
- metricsSubMetric[]
- aggregatorstring
- display_titlestring
- event_idinteger
- event_typestring
- fieldstring
- rolestring<numerator | denominator>Allowednumeratordenominator
- scopestring
- project_idintegerDescription
- scopestring<session | visitor | event>DescriptionAllowedsessionvisitorevent
- visibilitystring<account | experiment | project>DescriptionAllowedaccountexperimentproject
- winning_directionstring<increasing | decreasing>requiredDescriptionAllowedincreasingdecreasing
- namestringrequiredExampleDescriptionMax Length255
- project_idinteger<int64>ExampleDescriptionFormatint64
- projectsobject[]Example
[ { "id": 123 } ]Description- idinteger<int64>DescriptionFormatint64
- revisionintegerExampleDescription
- rulesobject[]Example
[ { "flag_key": "my_flag", "id": 456, "key": "experiment_rule_a", "name": "Experiment Rule A", "project_id": 123 } ]Description- flag_idinteger<int64>DescriptionFormatint64
- flag_keystringDescription
- flag_namestringDescription
- idinteger<int64>DescriptionFormatint64
- keystringDescription
- namestringDescription
- project_idinteger<int64>DescriptionFormatint64
- scopestring<global | local>ExampleDescriptionAllowedgloballocal
- start_timestring<date-time>ExampleDescriptionFormatdate-time
- statusstring<draft | running | concluded>ExampleDescriptionAlloweddraftrunningconcluded
- traffic_allocationintegerExampleDescriptionMinimum0Maximum10000
- updated_timestring<date-time>ExampleDescriptionFormatdate-time
- urlstringExampleDescription
- urnstringExampleDescription
Response Headers
- ETagstringExampleDescription
400
401
403
404
409
curl
curl --request PATCH \
--url https://api.optimizely.com/flags/v1//holdouts/{holdout_id} \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json-patch+json");
var requestOptions = {
method: 'PATCH',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.optimizely.com/flags/v1//holdouts/{holdout_id}", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://api.optimizely.com/flags/v1//holdouts/{holdout_id}")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json-patch+json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.optimizely.com/flags/v1//holdouts/{holdout_id}"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json-patch+json'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
200
// Holdout successfully updated
{
"archived": false,
"audience_conditions": [
{}
],
"audience_ids": [
0
],
"created_by_user_email": "[email protected]",
"created_time": "2023-12-15T10:00:00.000Z",
"description": "Holdout group to measure the overall impact of our growth experiments throughout the year",
"end_time": "2024-12-31T23:59:59.000Z",
"environment_key": "production",
"environment_name": "Production",
"exclude_targeted_deliveries": false,
"holdout_results_api_token": "SampleToken.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"id": 12345,
"key": "annual_growth_holdout",
"metrics": [
{
"aggregator": "",
"display_title": "",
"display_unit": "",
"event_id": 32334454244,
"event_properties": {
"filter": {
"combine_operator": "",
"conditions": [
{
"name": "",
"operator": "",
"type": "",
"value": ""
}
]
}
},
"event_type": "",
"field": "",
"id": "",
"metrics": [
{
"aggregator": "",
"display_title": "",
"event_id": 0,
"event_type": "",
"field": "",
"role": "",
"scope": ""
}
],
"project_id": 0,
"scope": "",
"visibility": "",
"winning_direction": ""
}
],
"name": "Annual Growth Control Group",
"project_id": 98765,
"projects": [
{
"id": ""
}
],
"revision": 3,
"rules": [
{
"flag_id": "",
"flag_key": "",
"flag_name": "",
"id": "",
"key": "",
"name": "",
"project_id": ""
}
],
"scope": "global",
"start_time": "2024-01-01T00:00:00.000Z",
"status": "running",
"traffic_allocation": 1000,
"updated_time": "2024-01-01T10:00:00.000Z",
"url": "/holdouts/12345",
"urn": "holdout.flag.optimizely.com::12345"
}400
// Malformed requests and invalid parameter names and types
401
// Invalid credentials
403
// Do not have permission to perform the operation
404
// Not found. No content
409
// Conflict - concurrent modification detected (optimistic lock failure)