Disable the Ruleset for a Flag in an Environment
1 min
POST
https://api.optimizely.com/flags/v1//projects/{project_id}/flags/{flag_key}/environments/{environment_key}/ruleset/disabled
Path Parameters
- project_idintegerrequiredExampleDescription
- flag_keystringrequiredExampleDescription
- environment_keystringrequiredExampleDescription
Responses
200
- RulesetExample
{ "archived": false, "default_variation_key": false, "default_variation_name": false, "disable_url": "...", "enable_url": "...", "enabled": false, "environment_key": "development", "environment_name": "Development", "fetch_default_variation_url": "...", "fetch_flag_url": "...", "flag_key": "recurring_deposit", "id": 23456746, "rule_priorities": [ "landing_page_callout", "paid_users" ], "rules": { "landing_page_callout": { "allow_list": { "xyz123": { "user_id": "xyz123", "variation": { "key": false, "name": false } } }, "archived": false, "audience_conditions": [ "or", { "audience_id": 222222 } ], "audience_ids": [ 5340810295 ], "created_time": "2021-02-03T19:57:31.357168+00:00", "description": "", "distribution_mode": "stats_accelerator", "enabled": true, "id": 1, "key": "landing_page_callout", "layer_experiment_id\"": 9000000010002, "layer_id\"": 9000000010002, "metrics": [ { "aggregator": "sum", "display_title": "Increasing Revenue by Session", "event_id": 33333333, "event_type": "custom", "field": "revenue", "scope": "session", "winning_direction": "increasing" } ], "name": "Landing Page Callout", "percentage_included": 5000, "type": "a/b", "updated_time": "2021-02-03T19:57:31.357173+00:00", "urn": "rules.flags.optimizely.com::1", "variations": { "false": { "key": false, "name": false, "percentage_included": 5000 }, "true": { "key": true, "name": true, "percentage_included": 5000 } } }, "paid_users": { "allow_list": { "xyz123": { "user_id": "xyz123", "variation": { "key": false, "name": false } } }, "archived": false, "audience_conditions": [ "or", { "audience_id": 123456 } ], "audience_ids": [ 123456 ], "created_time": "2021-02-03T19:57:31.366368+00:00", "description": "", "enabled": true, "id": 2, "key": "paid_users", "layer_experiment_id\"": 9000000010003, "layer_id\"": 9000000010003, "metrics": [], "name": "Paid Users", "percentage_included": 10000, "type": "targeted_delivery", "updated_time": "2021-02-03T19:57:31.366372+00:00", "urn": "rules.flags.optimizely.com::2", "variations": { "true": { "key": true, "name": true, "percentage_included": 10000 } } } }, "update_url": "...", "updated_time": "2019-05-08T00:00:00+00:00", "url": "...", "urn": "rulesets.flags.optimizely.com::23456746" }Description- archivedbooleanDescription
- default_variation_keystringExampleDescription
- default_variation_namestringExampleDescription
- disable_urlobject
- UrlValue
- enable_urlobject
- UrlValue
- enabledbooleanDescriptionDefaultfalse
- environment_idnumberDescription
- environment_keystringrequiredExampleDescription
- environment_namestringExampleDescription
- fetch_default_variation_urlstringDescription
- fetch_flag_urlobjectDescription
- UrlValue
- flag_keystringrequiredExampleDescription
- idintegerExample
- revisionintegerDescription
- rolestringExampleDescription
- rule_prioritiesstring[]requiredExample
[ "new_users", "paid_users", "trial_users" ]
Description - rulesobject
- RuleMap
- statusstring<draft | running | paused>DescriptionAlloweddraftrunningpaused
- update_urlobject
- UrlValue
- updated_timestring<date-time>ExampleDescriptionFormatdate-time
- urlobjectrequiredDescription
- UrlValue
- urnstringrequiredExampleDescription
400
401
403
404
409
curl
curl --request POST \
--url https://api.optimizely.com/flags/v1//projects/{project_id}/flags/{flag_key}/environments/{environment_key}/ruleset/disabled \
--header 'accept: application/json'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.optimizely.com/flags/v1//projects/{project_id}/flags/{flag_key}/environments/{environment_key}/ruleset/disabled", 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//projects/{project_id}/flags/{flag_key}/environments/{environment_key}/ruleset/disabled")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://api.optimizely.com/flags/v1//projects/{project_id}/flags/{flag_key}/environments/{environment_key}/ruleset/disabled"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Successful disabling of the Ruleset.
The response includes RESTful JSON (https://restfuljson.org/) styled links. If a
link is not present in the response, it indicates a user is not authorized to access
the related resource.
{
"archived": false,
"default_variation_key": "high_discount",
"default_variation_name": "High Discount",
"disable_url": {},
"enable_url": {},
"enabled": false,
"environment_id": 0,
"environment_key": "production",
"environment_name": "Production",
"fetch_default_variation_url": "",
"fetch_flag_url": {},
"flag_key": "recurring_deposit",
"id": 23456746,
"revision": 0,
"role": "admin",
"rule_priorities": [
""
],
"rules": {},
"status": "",
"update_url": {},
"updated_time": "2019-05-08T00:00:00.000Z",
"url": {},
"urn": "ruleset.flag.optimizely.com::a308d9ae-89ba-11ea-bc55-0242ac130003"
}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
// The change is gated by an active change-approval policy (or flag scheduling was unavailable to verify it); submit it through flag scheduling as a change request.