Management API
The Management API is a secure REST API that provides read/write access to your rules and spaces.
API Request methods cheat sheet:
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.
NEW in v1.16.0! The Management API now fully support use of Rule Aliases when making requests.
If you're using the Regional Cloud version of DecisionRules, read more about API calls here.
Swagger
You can check out these endpoints and call them right away using swagger.
Swagger UI: https://api.decisionrules.io/api/docs/
Swagger JSON File: https://api.decisionrules.io/api/docs/json
Folder Paths
NEW in v1.18.1 Some Management API Endpoints now support targetting by Folder Path.
All Folder and select Rule endpoints now support targetting items by their folder path. Instead of having to provide the requests with Rule Aliases/IDs or Folder IDs users can now define the request target by leveraging the new Folder Path functionality.
Example:
To access Calculation v2 (see image below), instead of appending it's rule ID to the request as a parameter you can now specify the ?path= query parameter.
In this case to GET the rule the request would look like this:
To access the entire "Important" Folder the request could now look like this:
Request targets can be defined either by the ID or path, not both at the same time
Folder Paths have to always begin with a slash "/"
To target specific rule versions by path use the ?version= query parameter
Rules and Rule Flows
Get rule
GET
https://api.decisionrules.io/api/rule/:ruleId/:version?
Gets all of the infromation stored about the rule, including its content, version or input and output schemas.
If the version is specified, gets the version irrespective of the rule status.
If the version is not specified, gets the latest published version.
You can target the rule using Folder Path instead of the :ruleId and :version parameters.
Path Parameters
ruleId
string
Unique rule ID or alias which is common to all rule versions.
version
integer
Business rule version.
Path Query Parameters
path
string
Unique folder path leading to the rule.
version
integer
Business rule version.
Headers
Authorization*
string
Bearer
Content-Type*
string
application/json
Path Parameters
ruleId*
string
gM6RzkIZ2Yoa
version
integer
kwk9EqWFZN7S
Headers
Authorization*
string
LgWcKwwM0JXy
Content-Type*
string
RycZjvfN2via
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.
Update rule status
PUT
https://api.decisionrules.io/api/rule/status/:ruleId/:status/:version?
Changes rule status from pending to published and vice versa. If the version is not specified, the latest version will be used.
Path Parameters
ruleId*
String
Unique rule ID or alias which is common to all rule versions.
status*
String
pending XOR published
version
Number
rule version
Headers
Authorization*
String
Bearer MANAGEMENT_API_KEY
Content-Type*
String
application/json
Returns updated rule.
Update rule
PUT
https://api.decisionrules.io/api/rule/:ruleId/:version
Changes the rule according to the body of the request.
You can target the rule using Folder Path instead of the :ruleId and :version parameters.
Path Parameters
ruleId
string
Unique rule ID or alias which is common to all rule versions.
version
integer
Version of Rule
Path Query Parameters
path
string
Unique folder path leading to the rule.
version
integer
Business rule version.
Headers
Authorization*
string
Bearer
Content-Type*
String
application/json
Request Body
body*
object
A complete rule in JSON format
Path Parameters
ruleId*
string
9yrSPizz7lb5
version*
integer
TJzLrOP1EINh
Headers
Authorization*
string
6M4q9gDafPGp
Content-Type*
String
OpsT3twTFJRe
Request Body
body*
object
wo4gaGQFjC7p
Update rule might be useful when renaming a rule. First GET the rule you wish to rename, change thename
attribute of the returned JSON object and then use PUT Update rule with the changed JSON object.
Note that there are a few attributes of the rule that cannot be updated by the PUT
endpoint. Namely, you cannot use PUT
to change the rule ID, version and rule alias. Also, you cannot change the date of last update, since it gets updated automatically.
Create rule
POST
https://api.decisionrules.io/api/rule
Creates rule based on the body of the request. The body must be formatted according to the example below.
You can create the rule in a specific folder by utilizing Folder Path.
Path Query Parameters
path
string
Unique folder path leading to the rule.
version
integer
Business rule version.
Headers
Authorization*
string
Bearer <MANAGEMENT_API_KEY>
Content-Type*
String
application/json
Request body example
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.
Delete rule
DELETE
https://api.decisionrules.io/api/rule/:ruleId/:version
Deletes the rule.
You can target the rule using Folder Path instead of the :ruleId and :version parameters.
Path Parameters
ruleId*
string
Unique rule ID or alias which is common to all rule versions.
version
integer
Version of Rule. If not specified, all versions will be deleted!
Path Query Parameters
path
string
Unique folder path leading to the rule.
version
integer
Business rule version.
Headers
Authorization*
string
Bearer
Content-Type*
String
application/json
Path Parameters
ruleId*
string
CfMUHelZSIU2
version
integer
zwf3bIA5cDgU
Headers
Authorization*
string
kBQr0rNvibyK
Content-Type*
String
T9sgNzzO4IF2
If you do not specify version of the rule to be deleted, the endpoint will delete all versions of the rule. Please, use it with caution! Once deleted, rules cannot be recovered.
Lock rule
PATCH
https://api.decisionrules.io/api/lock/:ruleId/:version
Locks / Unlocks the rule.
You can target the rule using Folder Path instead of the :ruleId and :version parameters.
Path Parameters
ruleId
string
Unique rule ID or alias which is common to all rule versions.
version
integer
Version of Rule.
Path Query Parameters
path
string
Unique folder path leading to the rule.
version
integer
Business rule version.
Headers
Authorization*
string
Bearer
Content-Type*
String
application/json
Export Rule Flow with all rules
GET
https://api.decisionrules.io/api/rule-flow/export/:ruleFlowId/:version?
Export Rule Flow with all rules. If the version is not specified, export Rule Flow with the latest version.
Path Parameters
ruleFlowId*
String
Unique rule flow ID or alias which is common to all versions.
version
Number
Headers
Authorization*
String
Bearer
Content-Type*
String
application/json
Import Rule Flow with all rules
POST
https://api.decisionrules.io/api/rule-flow/import
Import Rule Flow with all rules. If no query parameters are set, a new Rule Flow will be created. If the new-version
and version
query parameter are set, a new version of the targeted Rule Flow will be created. If the overwrite
and version
query parameters are set, a specific version of the target rule flow will be overwritten.
Query Parameters
new-version
String
ID or alias of the target Rule Flow.
overwrite
String
ID or alias of the target Rule Flow.
version
Number
Version of target Rule Flow
Headers
Authorization*
String
Bearer
Content-Type*
String
application/json
Request example
Spaces
Gets all types of rules and ruleflows in space
GET
https://api.decisionrules.io/api/space/items
The desired space is determined by Management API Key. This endpoint also gets set of rules used in every ruleflow.
Headers
Authorizaion*
String
Bearer <API_KEY>
Content-Type
String
application/json
Headers
Authorizaion*
String
lf2RvZVYAbHB
Content-Type
String
jRB25nYzcToa
Tags
Get Rules/Rule Flows by tags
GET
https://api.decisionrules.io/api/tags/items
This endpoint allows you to get all rules/rule flows with certain tags. Desired space is derived from Management API Key.
Query Parameters
tags*
string
Comma separated list of tags. The query at the end of the url address should look like this: ?tags=tag1,tag2. Such query would select all the rules where tag array contains both tag1 and tag
Headers
Authorization*
String
Bearer <API_KEY>
Content-Type*
String
application/json
Add tags to Rule/Rule Flow
PATCH
https://api.decisionrules.io/api/tags/:id/:version?
If you specify the version, the tag/tags will be added to the specified version. If the version is not specified, the tag/tags will be added to all the versions with given ID.
Path Parameters
id*
string
Unique rule ID or alias which is common to all rule versions. You can also use rule alias.
version
string
version of Rule/Rule Flow
Headers
Authorization*
string
Bearer <API_KEY>
Content-Type*
String
application/json
Request Body
body*
array
array of tags to add i JSON format
Delete tags from Rule/Rule Flow
DELETE
https://api.decisionrules.io/api/tags/:id/:version?
If you specify the version, the tag/tags will be deleted from the specified version. If the version is not specified, the tag/tags will be deleted from all the versions with given ID.
Path Parameters
id*
string
Unique rule ID or alias which is common to all rule versions. You can also use rule alias.
version
string
version of Rule/Rule Flow
Query Parameters
tags*
string
Comma separated list of tags. The query at the end of the url address should look like this: ?tags=tag1,tag2
Headers
Authorization*
string
Bearer <API_KEY>
Content-Type*
String
application/json
RuleFlow Export/Import
Export Rule Flow with all rules
GET
https://api.decisionrules.io/api/rule-flow/export/:ruleFlowId/:version?
Export Rule Flow with all rules. If the version is not specified, export Rule Flow with the latest version.
Path Parameters
ruleFlowId*
String
Unique rule flow ID or alias which is common to all versions.
version
Number
Headers
Authorization*
String
Bearer
Content-Type*
String
application/json
Import Rule Flow with all rules
POST
https://api.decisionrules.io/api/rule-flow/import
Import Rule Flow with all rules. If no query parameters are set, a new Rule Flow will be created. If the new-version
and version
query parameter are set, a new version of the targeted Rule Flow will be created. If the overwrite
and version
query parameters are set, a specific version of the target rule flow will be overwritten.
Query Parameters
new-version
String
ID or alias of the target Rule Flow.
overwrite
String
ID or alias of the target Rule Flow.
version
Number
Version of target Rule Flow
Headers
Authorization*
String
Bearer
Content-Type*
String
application/json
Folders
Export folder with all rules
GET
https://api.decisionrules.io/api/folder/export/{nodeId}
Export folder with all rules. If no nodeId is set, then will be exported root directory.
Path Parameters
nodeId
String
If you know your folder id, you can export it. Otherwise you export root directory
Headers
Content-Type*
String
application/json
Authorization*
String
Bearer
Use the endpoints listed below to manage the folder structure of your space.
All Folder endpoints make use of Folder Paths for convenience.
If the request body contains rules (defined by baseId or ruleAlias), the are moved to fit with the request. In the request example below, if the space contains a rule with id "xxx-yyy-zzz", it will be moved into the newly created "Example Sub-Folder" Folder.
When moving Rules - If a version is not defined all of the rule versions will be moved.
Any existing Folder children of the target node will be deleted. (Rules, which aren't part of the request body will be moved to the root)
If the request body contains rules (defined by baseId or ruleAlias), the are moved to fit with the request. In the request example below, if the space contains a rule with id "xxx-yyy-zzz", it will be moved into the newly created "Example Sub-Folder" Folder.
When moving Rules - If a version is not defined all of the rule versions will be moved.
Data removal is permanent and cannot be undone.
Searchable attribues:
name - Name of the Folder or Rule
Note: this attribute searches for a RegExp match by default, if you wish to find nodes which match the input exactly prepend the input with "^" and append with "$". For example if you want to find items which are named exactly "ClientA", try searching "^ClientA$"
id - ID of the Folder
ruleAlias - Rule-Alias
Note: this attribute searches for a RegExp match by default, if you wish to find nodes which match the input exactly prepend the input with "^" and append with "$". For example if you want to find rules the exact alias "ClientA", try searching "^ClientA$"
baseId - RuleId of the Rule or Rule Flow
ruleType - type of rule
"decision-table" - Decision Table
"decision-tree" - Decision Tree
"complex-rule" - Scripting Rule
"composition" - Rule Flow
tags - Tags on a Rule
type - Type of Node in Folder Structure
FOLDER
RULE
ROOT
version - Version of the rule
ruleStatus
published
pending
Export folder with all rules
GET
https://api.decisionrules.io/api/folder/export/{nodeId}
You can target the rule using Folder Path instead of the :ruleId and :version parameters.
Path Parameters
nodeId
String
CVAEjOf71DAP
Path Query Parameters
path
string
Unique folder path leading to the rule.
version
integer
Business rule version.
Headers
Content-Type*
String
RGr6dnzLvhJy
Authorization*
String
2DWTCHKmYqZj
Import folder and all rules.
POST
https://api.decisionrules.io/api/folder/import/{targetNodeId}
Import folder with all rules into specific folder. If no targetNodeId is set, then will be imported into root directory.
You can target the rule using Folder Path instead of the :ruleId and :version parameters.
Path Parameters
targetNodeId
String
If you know you targetNodeId, you can import it. Otherwise you import folder into root directory.
Path Query Parameters
path
string
Unique folder path leading to the rule.
version
integer
Business rule version.
Headers
Content-Type*
String
application/json
Authorization*
String
Bearer
Request Body
export
object
exportType
string
version
number
createdAt
Date
data
object
Common Use cases
Tools
There are some additional tools for individual rules that can be taken advantage of. Their description can be found below.
Find duplicate conditions in decision table
GET
https://api.decisionrules.io/api/tools/duplicates/{ruleId}/{version}
Look for decision table by id and optionally version. If the decision table is found, it is returned together with an array of duplicates.
Path Parameters
ruleId*
String
version
String
rule version
Find all dependencies of a rule
GET
https://api.decisionrules.io/api/tools/dependencies/{identifier}/{version}
Look for dependencies by id or alias and optionally version. If the rule is found, it is returned together with an array of dependencies.
Path Parameters
identifier*
String
Id or Alias of the rule, you want to find out dependencies of.
version
String
Last updated