Evaluate a decision
HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("http://localhost:8080/v2/decision-definitions/evaluation")) .header("Authorization", "Bearer <token>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{ \"decisionDefinitionId\": \"order-discount\", \"variables\": { \"customerTier\": \"gold\", \"amount\": 129.5 } }")) .build();HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());System.out.println(response.body());const url = 'http://localhost:8080/v2/decision-definitions/evaluation';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"decisionDefinitionId":"order-discount","variables":{"customerTier":"gold","amount":129.5}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/v2/decision-definitions/evaluation \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "decisionDefinitionId": "order-discount", "variables": { "customerTier": "gold", "amount": 129.5 } }'Evaluates a deployed decision, chosen by decisionDefinitionId (the
latest version) or by decisionDefinitionKey, with the given
variables. A decision that fails to evaluate still answers 200 with
failedDecisionDefinitionId and failureMessage set.
evaluatedDecisions lists every decision evaluated, required
decisions first, each with its type, evaluated inputs and matched
rules.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters”Tenant selection. A principal bound to one tenant may omit it; if
sent, it must equal that tenant (403 otherwise). A principal that
may act in several tenants must send it on every request:
without it the request is refused with 400, and a tenant it may
not act in is refused with 403.
Makes a retried command safe. A repeat with the same key and the same
body replays the first answer. A repeat with the same key and a
different body is refused with 409.
Request Bodyrequired
Section titled “Request Bodyrequired”Exactly one of decisionDefinitionId or decisionDefinitionKey.
object
Positive signed 64-bit entity key, written as a decimal string.
object
Example
{ "decisionDefinitionId": "order-discount", "variables": { "customerTier": "gold", "amount": 129.5 }}Responses
Section titled “ Responses ”The decision was evaluated.
object
Positive signed 64-bit entity key, written as a decimal string.
Positive signed 64-bit entity key, written as a decimal string.
Same as decisionEvaluationKey.
Decimal key; -1 when no requirements graph was recorded.
object
The decision output as JSON text.
Rules that produced the result, in rule order (decision tables only).
object
The rule id; a rule without one gets ZB_SYNTH_RULE_ID_<decisionId>_v<version>_r<ruleIndex>.
One-based position of the rule in the table.
object
The output value as JSON text.
The matched rule’s id
The matched rule’s one-based position
Evaluated input values (decision tables only).
object
The input label
The evaluated value as JSON text.
Positive signed 64-bit entity key, written as a decimal string.
The decision output as JSON text (null on failure).
Example
{ "decisionDefinitionKey": "2251799813685249", "decisionEvaluationKey": "2251799813685249", "decisionInstanceKey": "2251799813685249", "evaluatedDecisions": [ { "decisionDefinitionType": "DECISION_TABLE", "decisionDefinitionKey": "2251799813685249" } ]}The request is malformed, or it uses a property or filter this release does not support.
An RFC 9457 problem document. type is a stable TinyConductor URN.
object
The request path.
Present only on mode-not-supported. It names the engine’s mode.
Example
{ "type": "urn:bpm:error:invalid-argument", "title": "Bad Request", "status": 400, "detail": "entity key must be a positive int64 string", "instance": "/v2/process-instances/0"}No valid credential was presented.
An RFC 9457 problem document. type is a stable TinyConductor URN.
object
The request path.
Present only on mode-not-supported. It names the engine’s mode.
Example
{ "type": "urn:bpm:error:unauthorized", "title": "Unauthorized", "status": 401, "detail": "A valid bearer credential is required", "instance": "/v2/decision-definitions/evaluation"}Headers
Section titled “Headers”The caller lacks the required permission, a tenant named in the request is not the caller’s tenant, or a cookie write has no valid CSRF token.
An RFC 9457 problem document. type is a stable TinyConductor URN.
object
The request path.
Present only on mode-not-supported. It names the engine’s mode.
Example
{ "type": "urn:bpm:error:forbidden", "title": "Forbidden", "status": 403, "detail": "The principal lacks the action this route requires", "instance": "/v2/decision-definitions/evaluation"}The entity does not exist in the caller’s tenant.
An RFC 9457 problem document. type is a stable TinyConductor URN.
object
The request path.
Present only on mode-not-supported. It names the engine’s mode.
Example
{ "type": "urn:bpm:error:not-found", "title": "Not Found", "status": 404, "detail": "The requested resource does not exist", "instance": "/v2/decision-definitions/evaluation"}An idempotency-key conflict, or a command the target’s current state does not allow.
An RFC 9457 problem document. type is a stable TinyConductor URN.
object
The request path.
Present only on mode-not-supported. It names the engine’s mode.
Example
{ "type": "urn:bpm:error:conflict", "title": "Conflict", "status": 409, "detail": "The idempotency key is already associated with another request", "instance": "/v2/decision-definitions/evaluation"}The body exceeds the configured request-size bound.
An RFC 9457 problem document. type is a stable TinyConductor URN.
object
The request path.
Present only on mode-not-supported. It names the engine’s mode.
Example
{ "type": "urn:bpm:error:payload-too-large", "title": "Payload Too Large", "status": 413, "detail": "The request exceeds the configured size limit", "instance": "/v2/decision-definitions/evaluation"}An internal failure. The details are never exposed.
An RFC 9457 problem document. type is a stable TinyConductor URN.
object
The request path.
Present only on mode-not-supported. It names the engine’s mode.
Example
{ "type": "urn:bpm:error:internal", "title": "Internal Server Error", "status": 500, "detail": "The request could not be completed", "instance": "/v2/decision-definitions/evaluation"}The operation is not offered in the engine’s current deployment mode.
An RFC 9457 problem document. type is a stable TinyConductor URN.
object
The request path.
Present only on mode-not-supported. It names the engine’s mode.
Example
{ "type": "urn:bpm:error:mode-not-supported", "title": "Mode Not Supported", "status": 501, "detail": "/v2/clock is not supported in bundled mode: the deterministic virtual clock and the storage-free reset exist only for the Embedded engine; Bundled and Cluster run on the system clock over durable history, which cannot be pinned, rewound or discarded", "instance": "/v2/clock", "mode": "bundled"}Backpressure, or a dependency is not ready. Retry with the same idempotency key.
An RFC 9457 problem document. type is a stable TinyConductor URN.
object
The request path.
Present only on mode-not-supported. It names the engine’s mode.
Example
{ "type": "urn:bpm:error:unavailable", "title": "Service Unavailable", "status": 503, "detail": "The required engine service is not ready", "instance": "/v2/decision-definitions/evaluation"}