Archive Flags
1 min
POST
https://api.optimizely.com/flags/v1//projects/{project_id}/flags/archived
Path Parameters
- project_idintegerrequiredExampleDescription
Header Parameters
- acceptstringDescriptionDefaultapplication/jsonAllowedapplication/jsonapplication/problem+json
Body Parameters
- bodyFlagArchiveRequestBodyrequiredExample
{ "keys": [ "recurring_deposit" ] }- objectBulkOperationsRequestBody
- keysstring[]Description
- object
- override_code_referencesbooleanDescriptionDefaultfalse
Responses
200
- FlagMapExample
{ "recurring_deposit": { "account_id": 12345, "archive_url": "...", "archived": true, "created_time": "2019-05-08T00:00:00.000Z", "delete_url": "string", "description": "Flag used for driving customers to use recurring deposits by showing a graph of compound interest over time", "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, "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" ] } } } }, "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
- FlagConflictErrorDescription
- detailstringExampleDescription
- errorstring<PENDING_APPROVALS_EXIST>ExampleDescriptionAllowedPENDING_APPROVALS_EXIST
- flag_keysstring[]Example
[ "checkout_redesign_2024", "recurring_deposit" ]
Description - messagestringExampleDescription
- statusintegerExampleDescription
- titlestringrequiredExampleDescription
- typestringExampleDescription
- uuidstringExampleDescription
curl
curl --request POST \
--url https://api.optimizely.com/flags/v1//projects/{project_id}/flags/archived \
--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/archived", 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/archived")
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/archived"
payload = {}
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Successful archive 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
// The Flags cannot be archived in their current state. No Flag in the batch
is archived.
Two body shapes are possible. A failed precondition returns a
FlagConflictError naming the Flags that blocked the request; its error
field says which precondition failed. Every other conflict returns a
ProblemDetail.
Discriminate on the presence of the error field rather than on the
response's content type: a ProblemDetail may arrive as either
application/json or application/problem+json.
{
"detail": "Cannot modify flag as it is referenced by ruleset",
"error": "PENDING_APPROVALS_EXIST",
"flag_keys": [
""
],
"message": "Cannot archive flag(s) with pending approval requests",
"status": 409,
"title": "Conflict",
"type": "about:blank",
"uuid": "3f2b9c14-7a0e-4d55-9e21-6c8b0a7d4e13"
}