Flags
This pages discusses the REST API calls for flags.
Flags replace the Experiments schema. Experiments are being deprecated. |
Flag schema
-
String name - The flag’s name
-
availableValues - The available values that this flag can be
-
-
String description - The description of the flag
-
Boolean enabled - Indicates if the flag is active
-
labels - The flag’s labels
-
-
String stickinessProperty - Stickiness property that controls percentage based tossing (shows if default value has been changed)
-
[Array] platforms - Specific platforms configurations
-
String platforms[].name - Name of the platform, as defined in the SDK running
-
String platforms[].flag - Override the flag name, when needed - deprecated
-
-
[Array] platforms[].conditions - Conditions Array for the specific platform (see Condition schema)
-
platforms[].value - Value when no condition is met for the specific platform
-
-
[Array] conditions - Default platform conditions (All platforms that have no specific configurations)
-
value - Value when no Condition is met (for the Default platform)
-
Boolean flags default is false. String, Number, and uninitialized flags default is null, which means the default value in the code will be used. |
Condition schema
-
value - The value when the Condition is met
-
Object dependency - Condition this flag value with another flag value
-
String dependency.flag - Flag name
-
-
dependency.value - The Flag dependent on’s value
-
Object group - Condition flag value based on target group(s)
-
String group.operator - The logical relationship between the groups
-
Array group.name - Name of target groups
-
-
Object version - Condition flag value based release version
-
String version.operator - The operator to compare version
-
String version.semver - The version to compare to
-
-
Object property - Condition flag value based directly on a custom property
-
String property.name - Name of a custom property
-
String property.operator - The operator to use on the property
-
String/Array/Number/Boolean property.operand - The operand to evaluate the operator with (value to compare with the custom property)
-
Flags calls
Get Flag
Returns a single flag by name
https://x-api.rollout.io/public-api/applications/<applicationId>/<environmentName>/flags/<flagName>
Node | cURL | Ruby | Python | Java | C# | Go |
---|---|---|---|---|---|---|
|
|
|
|
|
|
|
Get Flags
Returns all flags
https://x-api.rollout.io/public-api/applications/<applicationId>/<environmentName>/flags
Node | cURL | Ruby | Python | Java | C# | Go |
---|---|---|---|---|---|---|
|
|
|
|
|
|
|
PATH PARAMS
-
applicationId string - The application ID
-
environmentName string - The name of the environment
Flags response
Example:
[
{
"type": "flag",
"name": "myFlag",
"availableValues": [
"false",
"true"
],
"description": "my flag description",
"created": "2020-11-26T10:21:47.850Z",
"updated": "",
"enabled": false,
"labels": [],
"stickinessProperty": "rox.distinct_id",
"platforms": [],
"conditions": [],
"value": null
},
{
"type": "flag",
"name": "TestFlag2",
"availableValues": [
"false",
"true"
],
"description": "test flag description",
"created": "2020-11-25T12:06:58.028Z",
"updated": "",
"enabled": false,
"labels": [],
"stickinessProperty": "rox.distinct_id",
"platforms": [],
"conditions": [],
"value": false
},
{
"type": "flag",
"name": "TestFlag",
"availableValues": [
"false",
"true"
],
"description": "test flag description",
"created": "2020-11-25T13:58:58.034Z",
"updated": "2020-11-25T13:58:59.837Z",
"enabled": true,
"labels": [],
"stickinessProperty": "rox.distinct_id",
"platforms": [],
"conditions": [],
"value": false
},
{
"type": "flag",
"name": "default flag",
"availableValues": [
"false",
"true"
],
"description": "default flag description",
"created": "2020-11-27T12:41:22.837Z",
"updated": "2020-11-27T12:41:22.838Z",
"enabled": false,
"labels": [],
"stickinessProperty": "rox.distinct_id",
"platforms": [],
"conditions": [
{
"property": {
"name": "Foo",
"operator": "is-false"
},
"value": "abcd"
},
{
"group": {
"name": [
"target_group_1",
"target_group_2"
]
},
"value": "1234"
},
{
"version": {
"operator": "semver-eq",
"semver": "4"
},
"dependency": {
"flag": "default flag",
"value": "false"
},
"value": "sample"
}
],
"value": "sample"
}
]
Response schema type: Array of Flag schema
Create flag
Add a new flag to all environments.
Creatie Flag schema
-
String name - The flag’s name
-
availableValues - The available values that this flag can be (defaults to [true, false]), either array of number, or array of string
https://x-api.rollout.io/public-api/applications/<applicationId>/flags
Node | cURL | Ruby | Python | Java | C# | Go |
---|---|---|---|---|---|---|
|
|
|
|
|
|
|
Create a flag configuration
Add a new flag configuration or override an existing one.
https://x-api.rollout.io/public-api/applications/<applicationId>/environmentName/flags
Node | cURL | Ruby | Python | Java | C# | Go |
---|---|---|---|---|---|---|
|
|
|
|
|
|
|
Patch Flag
Patch Experiment object by flag name, patching is done according to JSON-Patch (RFC6902).
https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/environmentName/flags/flagName
Node | cURL | Ruby | Python | Java | C# | Go |
---|---|---|---|---|---|---|
|
|
|
|
|
|
|
PATH PARAMS
-
applicationId string - The application id
-
environmentName* string - The name of the environment that the flag belongs to
-
flagName* string - Flag name
BODY PARAMS
-
op string - The operation to be performed (one of
add
,remove
,replace
,move
,copy
,test
) -
path string - Path to the value that is to be changed. Ex:
path: value
is like sayingflag.value
-
value string - The value to be used within the operations
-
from string - A string containing a JSON Pointer value
Common patch body examples
Changing the stickiness property:
[{"op": "replace", "path": "/stickinessProperty", "value": "groupId"}]
Changing the flag’s value to true:
[{"op": "replace", "path": "/value", "value": true}]
Adding a group condition to the end of a flag’s configurations (assuming the flag already has conditions):
[{"op": "add", "path": "/conditions/-", "value": {"group":{"operator": "or", "name": "internalEmployees"}, "value": true}}]
Adding two items to the end of an equal one of
array, to the third condition of the flag:
[{"op": "add", "path": "/conditions/2/property/operand/-", "value": "Sokka"}, {"op": "add", "path": "/conditions/2/property/operand/-", "value": "Katara"}]
Setting the flag to false for the Android platform (assuming there are platforms set, but Android is not):
[{"op": "add", "path": "/platforms/-", "value": [{"name": "Android", "value": false}]}]
Delete Flag
Removes flag from the application by its flag name.
https://x-api.rollout.io/public-api/applications/1a23bcd4e5fg6h7890i123j4/flags/flagName
Node | cURL | Ruby | Python | Java | C# | Go |
---|---|---|---|---|---|---|
|
|
|
|
|
|
|