Update Flags
1 min
PATCH
https://api.optimizely.com/flags/v1//projects/{project_id}/flags
Path Parameters
- project_idintegerrequiredExampleDescription
Responses
200
- FlagMapExample
{ "recurring_deposit": { "account_id": 12345, "archive_url": "...", "archived": false, "created_time": "2019-05-08T00:00:00.000Z", "delete_url": "string", "description": "Updated description for recurring deposit flag", "environments": { "development": { "disable_url": "...", "enable_url": "...", "enabled": false, "is_primary": false, "key": "development", "name": "Development", "priority": 2, "rules_detail": [ { "audience_ids": [ 1 ], "created_time": "2022-01-08T00:00:00.000Z", "days_running": 30, "enabled": true, "id": 123, "key": "a/b", "name": "A/B Test", "primary_metric": "conversion_rate", "traffic_allocation": 100, "type": "experiment", "updated_time": "2022-01-08T00:00:00.000Z" } ], "rules_summary": { "a/b": { "keys": [ "new_users" ] }, "targeted_delivery": { "keys": [ "paid_users", "trial_users" ] } } }, "production": { "disable_url": "...", "enable_url": "...", "enabled": false, "key": "production", "name": "Production", "priority": 1, "rules_detail": [ { "audience_ids": [ 1 ], "created_time": "2022-01-08T00:00:00.000Z", "days_running": 30, "distribution_mode": "manual", "enabled": true, "fetch_results_ui_url": "...", "id": 123, "key": "a/b", "layer_experiment_id": 345, "name": "A/B Test", "primary_metric": "conversion_rate", "traffic_allocation": 100, "type": "experiment", "updated_time": "2022-01-08T00:00:00.000Z" } ], "rules_summary": { "a/b": { "keys": [ "new_users" ] }, "targeted_delivery": { "keys": [ "paid_users", "trial_users" ] } } } }, "id": 45633994, "key": "recurring_deposit", "name": "Recurring Deposit", "outlier_filtering_enabled": false, "project_id": 12345, "unarchive_url": "...", "update_url": "...", "updated_time": "2019-05-08T00:00:00.000Z", "url": "...", "urn": "flags.flag.optimizely.com::asdfsdf-2344-efadf03-343434-efrrr", "variable_definitions": { "advanced": { "default_value": "{\n\t\"hello\": 123\n}", "description": "This variable is used to configure the advanced used for advanced purposes", "key": "advanced", "type": "json" }, "amount": { "default_value": "0.0", "description": "This variable is used to configure the amount used for computing the discount", "key": "amount", "type": "double" }, "message": { "default_value": "Use recurring deposits to compound interest", "description": "This variable is used to configure the message used for displaying the discount", "key": "message", "type": "string" } } } }Description
400
401
403
404
409
curl
curl --request PATCH \
--url https://api.optimizely.com/flags/v1//projects/{project_id}/flags \
--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//projects/{project_id}/flags", 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")
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//projects/{project_id}/flags"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json-patch+json'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
200
// Successful update, archive or unarchive of Flags.
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.
{}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
// Conflicting resource state with requested action