Decide makes feature decisions for the selected query parameters.
1 min
POST
/v1/decide
Query Parameters
- keysstringDescription
Body Parameters
- bodyDecideContextrequired
- decideOptionsDecideOption[]
- userIdstringrequired
- userAttributesobject
- forcedDecisionsForcedDecision[]
- flagKeystringrequired
- ruleKeystring
- variationKeystringrequired
- fetchSegmentsboolean
- fetchSegmentsOptionsFetchSegmentsOption[]
Responses
200
- object
- objectOptimizelyDecision[]
- variablesobject
- variationKeystring
- enabledboolean
- ruleKeystringrequired
- flagKeystringrequired
- userContextUserContextrequired
- userIdstringrequired
- attributesobject
- reasonsstring[]
- objectOptimizelyDecision
- variablesobject
- variationKeystring
- enabledboolean
- ruleKeystringrequired
- flagKeystringrequired
- userContextUserContextrequired
- userIdstringrequired
- attributesobject
- reasonsstring[]
400
401
403
- Error
- errorstring
500
curl
curl --request POST \
--url /v1/decide \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"userId": "",
"forcedDecisions": [
{
"flagKey": "",
"variationKey": ""
}
]
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"userId": "",
"forcedDecisions": [
{
"flagKey": "",
"variationKey": ""
}
]
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("/v1/decide", 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("/v1/decide")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"userId": "",
"forcedDecisions": [
{
"flagKey": "",
"variationKey": ""
}
]
})
response = http.request(request)
puts response.read_body
python
import requests
import json
url = "/v1/decide"
payload = json.dumps({
"userId": "",
"forcedDecisions": [
{
"flagKey": "",
"variationKey": ""
}
]
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Valid response
{}400
// Missing required parameters
401
// Unauthorized, invalid JWT
403
// You do not have necessary permissions for the resource
{
"error": ""
}500
// Failed to fetch qualified segments
PREVIOUS
Return the datafile for the given environment. If you need strict consistency, you can pass the datafile to other Optimizely instances. so that all initialize from exactly the same datafile version (rather than each fetching the datafile separately from t
NEXT
Lookup returns saved user profile.