In order to implement the OFREP specification, our Core API needs a new endpoint that evaluates a single flag given a set of identity traits. The Edge API counterpart is Flagsmith/edge-api#712.
An interpretation of the specification to our data model is as the following example:
(request)
POST /ofrep/v1/evaluate/flags/{feature.name} HTTP/1.1
Host: {flagsmith_host}
X-API-Key: {server_side_environment_key}
Content-Type: application/json
{
"context": {
"targetingKey": "{identity.identifier}",
"trait1": "value1",
"trait2": "value2"
}
}
(response)
HTTP/1.1 200 OK
Content-Type: application/json
{
"key": "{feature.name}",
"value": "{multivariate_feature_option.value}",
"reason": "SPLIT",
"variant": "{multivariate_feature_option.key}"
}
(response, unknown flag)
HTTP/1.1 404 Not Found
Content-Type: application/json
{
"key": "{feature.name}",
"errorCode": "FLAG_NOT_FOUND"
}
Acceptance criteria
- Our API exposes a new endpoint
POST /ofrep/v1/evaluate/flags/{flagKey} compliant to the OFREP specification. As such, the endpoint:
- Serves the flag's value as its remote configuration value, falling back to the flag's enabled state when no value is set.
- Reports the flag's evaluation reason using the vocabulary OFREP defines.
- Responds
404 Not Found when the environment has no such flag.
- Is billed similarly to other billed endpoints.
- Persists the identity and its traits on the same terms as identity flag evaluation.
In order to implement the OFREP specification, our Core API needs a new endpoint that evaluates a single flag given a set of identity traits. The Edge API counterpart is Flagsmith/edge-api#712.
An interpretation of the specification to our data model is as the following example:
(request)
(response)
(response, unknown flag)
Acceptance criteria
POST /ofrep/v1/evaluate/flags/{flagKey}compliant to the OFREP specification. As such, the endpoint:404 Not Foundwhen the environment has no such flag.