Evaluate an Unleash context against a change request preview.
POST /api/admin/playground/change-request/:id
Use the provided context
to evaluate toggles on this Unleash instance with a change request applied in preview mode. You can use comma-separated values to provide multiple values to each context field. Returns a combinatorial list of all toggles that match the parameters and what they evaluate to.
Request
Path Parameters
- id string required
- application/json
Body
required
changeRequestPlaygroundRequestSchema
context objectrequired
The Unleash context as modeled in client SDKs
appName string requiredPossible values:
non-empty
The name of the application.
currentTime date-timeA DateTime (or similar) data class instance or a string in an RFC3339-compatible format. Defaults to the current time if not set by the user.
environment string deprecatedThe environment the app is running in.
properties object
Additional Unleash context properties
property name* stringremoteAddress stringThe app's IP address
sessionId stringAn identifier for the current session
userId stringAn identifier for the current user
property name* anyThe Unleash context as modeled in client SDKs
- 200
- 400
- 401
- 404
advancedPlaygroundResponseSchema
- application/json
- Schema
- Example (from schema)
Schema
input objectrequired
The given input used to evaluate the features.
environments string[] requiredPossible values:
>= 1
The environments to evaluate toggles in.
projects object
A list of projects to check for toggles in.
oneOf- MOD1
- MOD2
Array [string]stringPossible values: [
*
]Check toggles in all projects.
context objectrequired
The Unleash context as modeled in client SDKs
appName string requiredPossible values:
non-empty
The name of the application.
currentTime date-timeA DateTime (or similar) data class instance or a string in an RFC3339-compatible format. Defaults to the current time if not set by the user.
environment string deprecatedThe environment the app is running in.
properties object
Additional Unleash context properties
property name* stringremoteAddress stringThe app's IP address
sessionId stringAn identifier for the current session
userId stringAn identifier for the current user
property name* anyThe Unleash context as modeled in client SDKs
features object[]required
The list of features that have been evaluated.
Array [name string requiredThe feature's name.
projectId string requiredThe ID of the project that contains this feature.
environments objectrequired
The lists of features that have been evaluated grouped by environment.
property name* object[]
Array [name string requiredThe feature's name.
environment string requiredThe feature's environment.
context objectrequired
The context to use when evaluating flags
appName string requiredPossible values:
non-empty
The name of the application.
currentTime date-timeA DateTime (or similar) data class instance or a string in an RFC3339-compatible format. Defaults to the current time if not set by the user.
environment string deprecatedThe environment the app is running in.
remoteAddress stringThe app's IP address
sessionId stringAn identifier for the current session
userId stringAn identifier for the current user
property name* anyThe context to use when evaluating flags
projectId string requiredThe ID of the project that contains this feature.
strategies objectrequired
Feature's applicable strategies and cumulative results of the strategies
result objectrequired
The cumulative results of all the feature's strategies. Can be
true
,false
, orunknown
. This property will only beunknown
if one or more of the strategies can't be fully evaluated and the rest of the strategies all resolve tofalse
.anyOf- MOD1
- MOD2
booleanstringPossible values: [
unknown
]data object[]required
The strategies that apply to this feature.
Array [name string requiredThe strategy's name.
title stringDescription of the feature's purpose.
id string requiredThe strategy's id.
result objectrequired
The strategy's evaluation result. If the strategy is a custom strategy that Unleash can't evaluate,
evaluationStatus
will beunknown
. Otherwise, it will betrue
orfalse
anyOf- MOD1
- MOD2
evaluationStatus string requiredPossible values: [
incomplete
,unevaluated
]Signals that this strategy could not be evaluated. This is most likely because you're using a custom strategy that Unleash doesn't know about. The
unevaluated
result is also returned if the strategy is disabled.enabled objectrequired
Whether this strategy resolves to
false
or if it might resolve totrue
. Because Unleash can't evaluate the strategy, it can't say for certain whether it will betrue
, but if you have failing constraints or segments, it can determine that your strategy would befalse
.anyOf- MOD1
- MOD2
booleanPossible values: [
false
]stringPossible values: [
unknown
]evaluationStatus string requiredPossible values: [
complete
]Signals that this strategy was evaluated successfully.
enabled boolean requiredWhether this strategy evaluates to true or not.
variant objectnullable
The feature variant you receive based on the provided context or the disabled variant. If a feature is disabled or doesn't have any variants, you would get the disabled variant. Otherwise, you'll get one of the feature's defined variants.
name string requiredThe variant's name. If there is no variant or if the toggle is disabled, this will be
disabled
enabled boolean requiredWhether the variant is enabled or not. If the feature is disabled or if it doesn't have variants, this property will be
false
payload object
An optional payload attached to the variant.
type string requiredPossible values: [
json
,csv
,string
,number
]The format of the payload.
value string requiredThe payload value stringified.
variants object[]
The feature variants.
Array [name string requiredThe variants name. Is unique for this feature flag
weight number requiredPossible values:
<= 1000
The weight is the likelihood of any one user getting this variant. It is a number between 0 and 1000. See the section on variant weights for more information
weightType stringPossible values: [
variable
,fix
]Set to fix if this variant must have exactly the weight allocated to it. If the type is variable, the weight will adjust so that the total weight of all variants adds up to 1000
stickiness stringStickiness is how Unleash guarantees that the same user gets the same variant every time
payload object
Extra data configured for this variant
type string requiredPossible values: [
json
,csv
,string
,number
]The type of the value. Commonly used types are string, number, json and csv.
value string requiredThe actual value of payload
overrides object[]
Overrides assigning specific variants to specific users. The weighting system automatically assigns users to specific groups for you, but any overrides in this list will take precedence.
Array [contextName string requiredThe name of the context field used to determine overrides
values string[] requiredWhich values that should be overriden
]]disabled boolean nullable requiredThe strategy's status. Disabled strategies are not evaluated
segments object[]required
The strategy's segments and their evaluation results.
Array [id integer requiredThe segment's id.
name string requiredThe name of the segment.
result boolean requiredWhether this was evaluated as true or false.
constraints object[]required
The list of constraints in this segment.
Array [contextName string requiredThe name of the context field that this constraint should apply to.
operator string requiredPossible values: [
NOT_IN
,IN
,STR_ENDS_WITH
,STR_STARTS_WITH
,STR_CONTAINS
,NUM_EQ
,NUM_GT
,NUM_GTE
,NUM_LT
,NUM_LTE
,DATE_AFTER
,DATE_BEFORE
,SEMVER_EQ
,SEMVER_GT
,SEMVER_LT
]The operator to use when evaluating this constraint. For more information about the various operators, refer to the strategy constraint operator documentation.
caseInsensitive booleanDefault value:
false
Whether the operator should be case sensitive or not. Defaults to
false
(being case sensitive).inverted booleanDefault value:
false
Whether the result should be negated or not. If
true
, will turn atrue
result into afalse
result and vice versa.values string[]The context values that should be used for constraint evaluation. Use this property instead of
value
for properties that accept multiple values.value stringThe context value that should be used for constraint evaluation. Use this property instead of
values
for properties that only accept single values.result boolean requiredWhether this was evaluated as true or false.
]]constraints object[]required
The strategy's constraints and their evaluation results.
Array [contextName string requiredThe name of the context field that this constraint should apply to.
operator string requiredPossible values: [
NOT_IN
,IN
,STR_ENDS_WITH
,STR_STARTS_WITH
,STR_CONTAINS
,NUM_EQ
,NUM_GT
,NUM_GTE
,NUM_LT
,NUM_LTE
,DATE_AFTER
,DATE_BEFORE
,SEMVER_EQ
,SEMVER_GT
,SEMVER_LT
]The operator to use when evaluating this constraint. For more information about the various operators, refer to the strategy constraint operator documentation.
caseInsensitive booleanDefault value:
false
Whether the operator should be case sensitive or not. Defaults to
false
(being case sensitive).inverted booleanDefault value:
false
Whether the result should be negated or not. If
true
, will turn atrue
result into afalse
result and vice versa.values string[]The context values that should be used for constraint evaluation. Use this property instead of
value
for properties that accept multiple values.value stringThe context value that should be used for constraint evaluation. Use this property instead of
values
for properties that only accept single values.result boolean requiredWhether this was evaluated as true or false.
]parameters objectrequired
The strategy's constraints and their evaluation results.
property name* stringlinks objectrequired
A set of links to actions you can perform on this strategy
edit string required]isEnabledInCurrentEnvironment boolean requiredWhether the feature is active and would be evaluated in the provided environment in a normal SDK context.
isEnabled boolean requiredWhether this feature is enabled or not in the current environment. If a feature can't be fully evaluated (that is,
strategies.result
isunknown
), this will befalse
to align with how client SDKs treat unresolved feature states.variant objectnullablerequired
The feature variant you receive based on the provided context or the disabled variant. If a feature is disabled or doesn't have any variants, you would get the disabled variant. Otherwise, you'll get one of the feature's defined variants.
name string requiredThe variant's name. If there is no variant or if the flag is disabled, this will be
disabled
enabled boolean requiredWhether the variant is enabled or not. If the feature is disabled or if it doesn't have variants, this property will be
false
payload object
An optional payload attached to the variant.
type string requiredThe format of the payload.
value string requiredThe payload value stringified.
feature_enabled booleanWhether the feature is enabled or not. If the feature is disabled, this property will be
false
variants object[]required
The feature variants.
Array [name string requiredThe variants name. Is unique for this feature flag
weight number requiredPossible values:
<= 1000
The weight is the likelihood of any one user getting this variant. It is a number between 0 and 1000. See the section on variant weights for more information
weightType stringPossible values: [
variable
,fix
]Set to fix if this variant must have exactly the weight allocated to it. If the type is variable, the weight will adjust so that the total weight of all variants adds up to 1000
stickiness stringStickiness is how Unleash guarantees that the same user gets the same variant every time
payload object
Extra data configured for this variant
type string requiredPossible values: [
json
,csv
,string
,number
]The type of the value. Commonly used types are string, number, json and csv.
value string requiredThe actual value of payload
overrides object[]
Overrides assigning specific variants to specific users. The weighting system automatically assigns users to specific groups for you, but any overrides in this list will take precedence.
Array [contextName string requiredThe name of the context field used to determine overrides
values string[] requiredWhich values that should be overriden
]]]]warnings object
Warnings that occurred during evaluation.
invalidContextProperties string[]A list of top-level context properties that were provided as input that are not valid due to being the wrong type.
{
"input": {
"environments": [
"development",
"production"
],
"projects": [
"my-project"
],
"context": {
"appName": "My cool application.",
"currentTime": "2022-07-05T12:56:41+02:00",
"properties": {
"customContextField": "this is one!",
"otherCustomField": "3"
},
"remoteAddress": "192.168.1.1",
"sessionId": "b65e7b23-fec0-4814-a129-0e9861ef18fc",
"userId": "username@provider.com"
}
},
"features": [
{
"name": "my-feature",
"projectId": "my-project",
"environments": {}
}
],
"warnings": {
"invalidContextProperties": [
"string"
]
}
}
The request data does not match what we expect.
- application/json
- Schema
- Example (from schema)
Schema
- id string
The ID of the error instance
- name string
The name of the error kind
- message string
A description of what went wrong.
{
"id": "9c40958a-daac-400e-98fb-3bb438567008",
"name": "ValidationError",
"message": "The request payload you provided doesn't conform to the schema. The .parameters property should be object. You sent []."
}
Authorization information is missing or invalid. Provide a valid API token as the authorization
header, e.g. authorization:*.*.my-admin-token
.
- application/json
- Schema
- Example (from schema)
Schema
- id string
The ID of the error instance
- name string
The name of the error kind
- message string
A description of what went wrong.
{
"id": "9c40958a-daac-400e-98fb-3bb438567008",
"name": "AuthenticationRequired",
"message": "You must log in to use Unleash. Your request had no authorization header, so we could not authorize you. Try logging in at /auth/simple/login."
}
The requested resource was not found.
- application/json
- Schema
- Example (from schema)
Schema
- id string
The ID of the error instance
- name string
The name of the error kind
- message string
A description of what went wrong.
{
"id": "9c40958a-daac-400e-98fb-3bb438567008",
"name": "NotFoundError",
"message": "Could not find the addon with ID \"12345\"."
}