Skip to main content

Update value

PATCH 

/v2/settings/:settingKeyOrId/value

This endpoint updates the value of a Feature Flag or Setting with a collection of JSON Patch operations in a specified Environment.

Only the defaultValue, targetingRules, and percentageEvaluationAttribute fields are modifiable by this endpoint.

The advantage of using JSON Patch is that you can describe individual update operations on a resource without touching attributes that you don't want to change. It supports collection reordering, so it also can be used for reordering the targeting rules of a Feature Flag or Setting.

For example: We have the following resource of a Feature Flag.

{
"defaultValue": {
"boolValue": false
},
"targetingRules": [
{
"conditions": [
{
"userCondition": {
"comparisonAttribute": "Email",
"comparator": "sensitiveTextEquals",
"comparisonValue": {
"stringValue": "[email protected]"
}
}
}
],
"percentageOptions": [],
"value": {
"boolValue": true
}
}
]
}

If we send an update request body as below:

[
{
"op": "replace",
"path": "/targetingRules/0/value/boolValue",
"value": true
}
]

Only the first Targeting Rule's value is going to be set to false and all the other fields are remaining unchanged.

So we get a response like this:

{
"defaultValue": {
"boolValue": false
},
"targetingRules": [
{
"conditions": [
{
"userCondition": {
"comparisonAttribute": "Email",
"comparator": "sensitiveTextEquals",
"comparisonValue": {
"stringValue": "[email protected]"
}
}
}
],
"percentageOptions": [],
"value": {
"boolValue": false
}
}
]
}

Request

Responses