Management API
The Management API is a secure REST API that provides read/write access to your rules and spaces.
GET - Used to retrieve resource representation/information and not modify it in any way, e.g., get a JSON representaition of a rule with the GET RULES endpoint.
POST - Used to create new subordinate resources, e.g., creating a new rule in a Space or Importing a rule into a Space.
PUT - Used primarily to update an existing resource (if the resource does not exist, then API may decide to create a new resource or not), e.g., updating a Rule Flow
PATCH - Used to make a partial update on a resource, e.g., add Tags to an existing rule.
DELETE - Used to delete resources, e.g., deleting rules.
Unlike the DecisionRules Solver API, the Management API doesn't yet fully support the use of Rule Aliases when making requests. This feature is implemented as a BETA trial for GET requests via the Management API, other requests need to be made using RuleID.
You can check out these endpoints and call them right away using swagger.
get
https://api.decisionrules.io
/api/rule/:ruleId/:version?
Get rule
Get rule might be useful when you wish to create a new version of a rule. To do so you may GET the rule, manually change the
"version"
attribute of the returned JSON object and then use said object with the POST Create rule method. This will result in a new version of the rule being created.put
https://api.decisionrules.io
/api/rule/:ruleId/:version
Update rule
Update rule might be useful when renaming a rule. First GET the rule you wish to rename,
change the
"name"
attribute of the returned JSON object and then use PUT Update rule with the changed JSON object.put
https://api.decisionrules.io
/api/rule/status/:ruleId/:status/:version?
Update rule status
delete
https://api.decisionrules.io
/api/rule/:ruleId/:version
Delete rule
post
https://api.decisionrules.io
/api/rule
Create rule
This example serves as a template for request bodies when creating rules with POST Create rule.
When updating rules with PUT Update rule, the body of the request must have the same format as well.
Request
{
"name": "Test from Tutorial",
"description": "",
"inputSchema": {
"Input attribute": {}
},
"outputSchema": {
"Output Attribute": {}
},
"decisionTable": {
"columns": [
{
"condition": {
"type": "simple",
"inputVariable": "Input attribute",
"name": "New Condition"
},
"columnId": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"type": "input"
},
{
"columnOutput": {
"type": "simple",
"outputVariable": "Output Attribute",
"name": "New Result"
},
"columnId": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"type": "output"
}
],
"rows": [
{
"cells": [
{
"column": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"scalarCondition": {
"value": "",
"operator": "anything"
},
"type": "input"
},
{
"column": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"outputScalarValue": {
"value": "Hello from Tutorial"
},
"type": "output"
}
],
"active": true
}
]
},
"type": "decision-table",
"status": "published",
"createdIn": "2021-09-08T11:40:32.542Z",
"lastUpdate": "2021-09-08T11:40:59.398Z",
"tags": ["tagName"]
}
get
https://api.decisionrules.io
/api/space/items
Gets all types of rules and ruleflows in space
get
https://api.decisionrules.io
/api/tags/items
Get Rules/Rule Flows by tags
patch
https://api.decisionrules.io
/api/tags/:id/:version?
Add tags to Rule/Rule Flow
[
{
"tagName": "yourTagName",
"color": "green"
}
]
// tagName is required
// No special characters other than: "()?!_.: -" are allowed
// color is optional
// you can select one of these colors: gray, violet, yellow, green, red, white
// if you don't input color field, default color will be inserted automatically
delete
https://api.decisionrules.io
/api/tags/:id/:version?
Delete tags from Rule/Rule Flow
get
https://api.decisionrules.io
/api/rule-flow/:ruleFlowId/:version?
Get Rule Flow
put
https://api.decisionrules.io
/api/rule-flow/:ruleFlowId/version
Update Rule Flow
{
"_id": "62627b2ac0fc11362331185e",
"name": "Sample Rule Flow",
"description": "This is sample description",
"inputSchema": {
"period": {},
"productType": {},
"promoCode": {}
},
"outputSchema": {
"finalPrice": {},
"crudePrice": {},
"message": {}
},
"type": "composition",
"status": "pending",
"visualEditorData": {
"drawflow": {
"Home": {
"data": {
"1": {
"id": 1,
"data": {
"type": "start"
},
"inputs": {},
"outputs": {
"output_1": {
"connections": [
{
"node": "2",
"output": "input_1"
}
]
}
},
"pos_x": 57,
"pos_y": 218
},
"2": {
"id": 2,
"data": {
"type": "node",
"baseId": "f36bf7cf-bef4-1f4c-d756-c0b6f2f814ff",
"globalVariable": "Rule_1"
},
"inputs": {
"input_1": {
"connections": [
{
"node": "1",
"input": "output_1"
}
]
}
},
"outputs": {
"output_1": {
"connections": [
{
"node": "3",
"output": "input_1"
}
]
}
},
"pos_x": 400,
"pos_y": 150
},
"3": {
"id": 3,
"data": {
"type": "end"
},
"inputs": {
"input_1": {
"connections": [
{
"node": "2",
"input": "output_1"
}
]
}
},
"outputs": {},
"pos_x": 785,
"pos_y": 212
}
}
}
}
},
"dataTree": {
"children": [
{
"baseId": "f36bf7cf-bef4-1f4c-d756-c0b6f2f814ff",
"children": [
{
"children": [
null
],
"globalVariable": "end",
"mapping": [
{
"key": "finalPrice",
"source": "Rule_1",
"sourceVariable": "prices.finalPrice"
},
{
"key": "crudePrice",
"source": "Rule_1",
"sourceVariable": "prices.crudePrice"
},
{
"key": "message",
"source": "Rule_1",
"sourceVariable": "message"
}
]
}
],
"globalVariable": "Rule_1",
"mapping": [
{
"key": "period",
"source": "start",
"sourceVariable": "period"
},
{
"key": "productType",
"source": "start",
"sourceVariable": "productType"
},
{
"key": "promoCode",
"source": "start",
"sourceVariable": "promoCode"
}
]
}
],
"globalVariable": "start",
"mapping": []
},
"compositionId": "94c5ef08-d609-ef88-066a-fbeda7d1e537",
"version": 1,
"createdIn": "2022-04-22T09:53:46.744Z",
"lastUpdate": "2022-04-22T09:53:46.744Z"
}
put
https://api.decisionrules.io
/api/rule-flow/status/:ruleId/:status/:version
Update Rule Flow Status
delete
https://api.decisionrules.io
/api/rule-flow/:ruleFlowId/:version
Delete Rule Flow
post
https://api.decisionrules.io
/api/rule-flow
Create Rule Flow
{
"_id": "62627b2ac0fc11362331185e",
"name": "Sample Rule Flow",
"description": "This is sample description",
"inputSchema": {
"period": {},
"productType": {},
"promoCode": {}
},
"outputSchema": {
"finalPrice": {},
"crudePrice": {},
"message": {}
},
"type": "composition",
"status": "pending",
"visualEditorData": {
"drawflow": {
"Home": {
"data": {
"1": {
"id": 1,
"data": {
"type": "start"
},
"inputs": {},
"outputs": {
"output_1": {
"connections": [
{
"node": "2",
"output": "input_1"
}
]
}
},
"pos_x": 57,
"pos_y": 218
},
"2": {
"id": 2,
"data": {
"type": "node",
"baseId": "f36bf7cf-bef4-1f4c-d756-c0b6f2f814ff",
"globalVariable": "Rule_1"
},
"inputs": {
"input_1": {
"connections": [
{
"node": "1",
"input": "output_1"
}
]
}
},
"outputs": {
"output_1": {
"connections": [
{
"node": "3",
"output": "input_1"
}
]
}
},
"pos_x": 400,
"pos_y": 150
},
"3": {
"id": 3,
"data": {
"type": "end"
},
"inputs": {
"input_1": {
"connections": [
{
"node": "2",
"input": "output_1"
}
]
}
},
"outputs": {},
"pos_x": 785,
"pos_y": 212
}
}
}
}
},
"dataTree": {
"children": [
{
"baseId": "f36bf7cf-bef4-1f4c-d756-c0b6f2f814ff",
"children": [
{
"children": [
null
],
"globalVariable": "end",
"mapping": [
{
"key": "finalPrice",
"source": "Rule_1",
"sourceVariable": "prices.finalPrice"
},
{
"key": "crudePrice",
"source": "Rule_1",
"sourceVariable": "prices.crudePrice"
},
{
"key": "message",
"source": "Rule_1",
"sourceVariable": "message"
}
]
}
],
"globalVariable": "Rule_1",
"mapping": [
{
"key": "period",
"source": "start",
"sourceVariable": "period"
},
{
"key": "productType",
"source": "start",
"sourceVariable": "productType"
},
{
"key": "promoCode",
"source": "start",
"sourceVariable": "promoCode"
}
]
}
],
"globalVariable": "start",
"mapping": []
},
"compositionId": "94c5ef08-d609-ef88-066a-fbeda7d1e537",
"version": 1,
"createdIn": "2022-04-22T09:53:46.744Z",
"lastUpdate": "2022-04-22T09:53:46.744Z"
}
get
https://api.decisionrules.io
/api/rule-flow/export/:ruleFlowId/:version?
Export Rule Flow with all rules
post
https://api.decisionrules.io
/api/rule-flow/import
Import Rule Flow with all rules
Import-RuleFlow-example.json
33KB
Code
There are some additional tools for individual rules that can be taken advantage of. Their description can be found below.
get
https://api.decisionrules.io/api
/tools/duplicates/{ruleId}/{version}
Find duplicate conditions in decision table
{
"rule": {
"_id": "6305ec5a42a45d1591c40767",
"name": "Simple Sample",
"description": "",
"inputSchema": {
"input": {}
},
"outputSchema": {
"output": {}
},
"decisionTable": {
"columns": [
{
"condition": {
"type": "simple",
"inputVariable": "input",
"name": "New Condition"
},
"columnId": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"type": "input"
},
{
"columnOutput": {
"type": "simple",
"outputVariable": "output",
"name": "New Result"
},
"columnId": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"type": "output"
}
],
"rows": [
{
"cells": [
{
"column": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"scalarCondition": {
"operator": "=",
"value": "0",
"type": "general"
},
"type": "input"
},
{
"column": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"outputScalarValue": {
"type": "common",
"value": "A"
},
"type": "output"
}
],
"active": true
},
{
"cells": [
{
"column": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"scalarCondition": {
"operator": "=",
"value": "1",
"type": "general"
},
"type": "input"
},
{
"column": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"outputScalarValue": {
"type": "common",
"value": "B"
},
"type": "output"
}
],
"active": true
},
{
"cells": [
{
"column": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"scalarCondition": {
"operator": "=",
"value": "1",
"type": "general"
},
"type": "input"
},
{
"column": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"outputScalarValue": {
"type": "common",
"value": "BB"
},
"type": "output"
}
],
"active": true
},
{
"cells": [
{
"column": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"scalarCondition": {
"operator": "=",
"value": "2",
"type": "general"
},
"type": "input"
},
{
"column": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"outputScalarValue": {
"type": "common",
"value": "C"
},
"type": "output"
}
],
"active": true
},
{
"cells": [
{
"column": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"scalarCondition": {
"operator": "=",
"value": "1",
"type": "general"
},
"type": "input"
},
{
"column": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"outputScalarValue": {
"type": "common",
"value": "BBB"
},
"type": "output"
}
],
"active": true
}
]
},
"type": "decision-table",
"status": "published",
"auditLog": {
"active": false,
"debug": {
"active": false
},
"ttl": 14
},
"ruleId": "3ea681e8-256a-7ddf-9fd2-e79fac231d60",
"version": 1,
"tags": [],
"baseId": "3ea681e8-256a-7ddf-9fd2-e79fac231d60",
"createdIn": "2022-08-24T09:16:10.142Z",
"lastUpdate": "2022-08-24T09:17:56.036Z"
},
"duplicates": [
{
"indices": [
1,
2,
4
],
"rows": [
{
"cells": [
{
"column": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"scalarCondition": {
"operator": "=",
"value": "1",
"type": "general"
},
"type": "input"
},
{
"column": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"outputScalarValue": {
"type": "common",
"value": "B"
},
"type": "output"
}
],
"active": true
},
{
"cells": [
{
"column": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"scalarCondition": {
"operator": "=",
"value": "1",
"type": "general"
},
"type": "input"
},
{
"column": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"outputScalarValue": {
"type": "common",
"value": "BB"
},
"type": "output"
}
],
"active": true
},
{
"cells": [
{
"column": "ec57bb7c-8e90-4aee-da49-17b607a6b09a",
"scalarCondition": {
"operator": "=",
"value": "1",
"type": "general"
},
"type": "input"
},
{
"column": "2e46eb73-de05-51bc-5913-4b261bbe2069",
"outputScalarValue": {
"type": "common",
"value": "BBB"
},
"type": "output"
}
],
"active": true
}
]
}
]
}
All of these endpoints will be deprecated from version 1.7.1 and newer.
post
https://api.decisionrules.io
/api/rule/:spaceId
Create rule
get
https://api.decisionrules.io
/api/space/:spaceId
Get all rules/rule flows in space
get
https://api.decisionrules.io
/api/tags/rules/:spaceId
Get rules by tag/tags
patch
https://api.decisionrules.io
/api/tags/rules/:spaceId/:ruleId/:version?
Add tags to rule
delete
https://api.decisionrules.io
/api/tags/rules/:spaceId/:ruleId/:version?
Delete tags from rule
Last modified 43m ago