Rule Solver API
Request and response from API solving.
The Rule Solver API is the most important API of DecisionRules. It allows you to send requests to solve rules (decision tables, decision trees, etc.) and obtain the output data. Below, you will find the specification of the single endpoint of this API.
In version 1.16.0 and newer you can solve your ruleflow with Rule Solver API endpoint.
Rule flow Solver API endpoint is now deprecated.
Swagger
You can check out these endpoints and call them right away using swagger.
Swagger UI: https://api.decisionrules.io/api/solver/docs
Swagger JSON File: https://api.decisionrules.io/api/solver/docs/json
This endpoint allows you to solve your rule while providing input data in JSON format. If the {version}
parameter is omitted from the path, the last published version will be used automatically.
Unique identifier for the rule that is common to all rule versions. Instead of rule ID, it is possible to use a rule alias.
Business rule version. If the parameter is not filled in, the last published version will be used automatically.
Bearer Solver_API_Key
The media type of the request body. Example: application/json.
application/json
Defines the execution strategy. Possible values: STANDARD, ARRAY, FIRST_MATCH.
STANDARD
Possible values: Correlation ID, if you'd like to set it manually. If not present, it will be generated automatically and returned in the response.
Decides whether an audit of the solve should be created and saved. Use 'true' to enable auditing.
true
Possible values: Number of days after which the audit will be deleted. Default is 14 days.
14
Enables or disables debug mode. Default is 'false'.
false
Possible values: JSON object that describes the input json data.
Object specifying solver options.
OK
Bad Request
Authentication token missing
POST /rule/solve/{ruleId}/{version}? HTTP/1.1
Host:
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 81
{
"data": {
"monthlySalaryInDollars": 2000,
"typeOfContract": "employee"
},
"options": {}
}
[
{
"car": {
"price": "666666",
"seats": {},
"discount": {
"low": "2",
"high": "33"
}
}
},
{
"car": {
"price": "8888888",
"seats": {},
"discount": {
"low": "8",
"high": "33"
}
}
}
]
Request example
URL
https://api.decisionrules.io/rule/solve/:ruleId/:version
Headers:
Content-Type: application/json
Authorization: Bearer DOZpz-h6xnOrKGIINlYvkd9hn41pRR3oG6cqH
The body of the request needs to have the following structure.
{
"data": {
// INPUT OBJECT
}
}
For example, it may look as follows. Note that the object provided under the data
key needs to correspond to the input model of the rule you wish to solve (see Rule Settings -> I/O Model).
{
"data": {
"client": {
"age": 18
}
}
}
Simple Solve
Simple solve means that you send a single set of input data and the solver thus evaluates this single input. The response is an array of results (given e.g. by the individual rows of a decision table).
Rule
Simple Request
This is how the object sent under the data
key could look for the given rule.
{
"client": {
"age": 18
},
"productCount": {
"accountsAndCards": 4,
"Investments": 4
},
"portfolioAmount": 15000
}
Simple Response
And this would be the response. Suppose that only one row of the decision table was triggered and the output is therefore an array with a single output data object (corresponding to the outputs set on the triggered row).
[
{
"totalProducts": 8,
"amountPerProduct": 1875,
"client": {
"segment": "senior affluent"
},
"profitability": 1
}
]
Bulk Solve
On the other hand, DecisionRules also supports the bulk solve, which is a call to the solver where you include multiple sets of input data. Each set is evaluated individually, with no relation to any other, and the solver returns an array of the corresponding output objects.
Rule

Bulk Request
This is how the JSON under the data
key of a bulk request is structured. Instead of an input data object, you send an array of these objects.
[
{
"product": {
"id": "P1",
"price": 400
},
"paymentMethod": {
"debitCard": true,
"creditCard": false,
"cash": {}
}
},
{
"product": {
"id": "P2",
"price": 300
},
"paymentMethod": {
"debitCard": true,
"creditCard": {},
"cash": {}
}
}
]
Bulk Response
And here is the response. The outer array corresponds to the array provided in the bulk input. The inner arrays specify the individual results, just as in the case of a simple solve. Thus, in the following example, you can see two elements of the outer array corresponding to the two input data objects sent over in our bulk request (as seen above). Each of these elements is an array which holds a single result (therefore, a single row of the decision table was triggered for both sets of input data).
[
[
{
"suplier": "Amazon",
"amount": 400
}
],
[
{
"suplier": "Lenovo",
"amount": 300
}
]
]
Options
As you might have noticed, the body of the request to the Rule Solver API takes an optional options
object. This object allows to configure the solver. In general, the options are different for each type of rule. As of now, they are only used for decision tables.
If you are solving a decision table, you may configure the solver with the following options.
Included Condition Cols
Allows to specify condition columns that should be taken in account when solving the decision table. All other columns will be ignored. Columns are identified by the name of the input variable related to the respective column.
For example, the body of the request may look like this.
{
"data": {
// INPUT OBJECT
},
"options": {
"includedConditionCols": ["client.age","portfolioAmount"]
}
}
With this configuration, only the columns related to client.age
and portfolioAmount
input variables will be evaluated.
Excluded Condition Cols
If you wish to exclude some columns, you can do that with this property. Columns are identified by the name of the input variable related to the respective column.
The body of the request may look as follows.
{
"data": {
// INPUT OBJECT
},
"options": {
"excludedConditionCols": ["client.age","portfolioAmount"]
}
}
With this setup, all columns except the client.age
and portfolioAmount
will be considered when solving of the decision table.
As of now, there are no other options supported; in particular, there are no options that would affect other types of rules. However, it is expected that these will be added in the future with the evolving capabilities of DecisionRules.
Last updated