API
|
Method
|
Syntax
|
Request Body
|
Response Body
|
HTTP Status Codes
|
Notes
|
Query Rules in Package
|
GET
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/rules<br/>
Optional parameters:
- &nodeId=457
- &baseSalience=99000
|
N/A
|
[+]Show
{
"rules":[
{
"ruleId":"f22d35f6-e31e-41f2-8e62-97864c47579a",
"ruleType":"DECISION_TABLE",
"extRuleId":"DT-163",
"name":"DEF",
"description":"Sample2",
"phase":"2nd",
"calendarId":"Calendar_117",
"nodeId":"pkg",
"locked":false,
"lockOwner":null,
"dateEffective":null,
"dateExpired":null,
"pendingSnapshot":true
},
{
"ruleId":"820a0434-9e46-4a44-b0e7-fea201a17282",
"ruleType":"DECISION_TABLE",
"extRuleId":"DT-186",
"name":"3rd",
"description":"",
"phase":"3rd",
"calendarName":"none",
"nodeId":"pkg",
"locked":false,
"lockOwner":null,
"dateEffective":null,
"dateExpired":null,
"pendingSnapshot":true
},
{
"ruleId":"a60416af-80a9-4378-be58-785c12b3ba8e",
"ruleType":"LINEAR",
"extRuleId":"Rule-100",
"name":"1st Date",
"description":"Basic criteria",
"phase":"1st",
"calendarName":"none",
"nodeId":"pkg",
"locked":false,
"lockOwner":null,
"dateEffective":null,
"dateExpired":null,
"pendingSnapshot":true
},
{
"ruleId":"061619bb-de47-4bda-80a1-2e1ade5fa010",
"ruleType":"LINEAR",
"extRuleId":"Rule-110",
"name":"Default",
"description":"Default is NO WAY BUDDY",
"phase":"--none--",
"calendarName":"none",
"nodeId":"pkg",
"locked":false,
"lockOwner":null,
"dateEffective":null,
"dateExpired":null,
"pendingSnapshot":true
},
{
"ruleId":"65cda7d5-09b4-47ec-9f7d-d90144be7f89",
"ruleType":"LINEAR",
"extRuleId":"Rule-130",
"name":"Check day",
"description":"No dating on holidays!",
"phase":"--none--",
"calendarName":"Calendar_117",
"nodeId":"pkg",
"locked":false,
"lockOwner":null,
"dateEffective":null,
"dateExpired":null,
"pendingSnapshot":true
}
]
}
|
- 200 OK—Response body provided
- 401 Unauthorized—APIToken not valid
- 403 Forbidden—User does not have permission for the specified tenant ID, or does not have the correct permission for this operation.
- 404 Not Found—could not find specified package ID. Use Query Packages to obtain correct ID.
- 503—Service Unavailable
|
User must have RULE_VIEW permission
By default, this query returns all rules in the specified package.
To further filter, specify: &nodeId, which returns only rules at that node within the rule package.
Notes:
If "nodeId" is set to "pkg", API will return only rules at the package level.
For sub-node, set both "nodeId" and "baseSalience" values for the node being queried. Both of these are returned on the "Query Business Hierarchy" API
|
Query Linear Rule Body
|
GET
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/linearrulebody/{ruleId}
|
N/A
|
[+]Show
{
"ruleId":"a60416af-80a9-4378-be58-785c12b3ba8e",
"ruleType":"LINEAR",
"extRuleId":"Rule-100",
"name":"DEF",
"description":"Basic criteria",
"phase":"1st",
"calendarId":"Calendar_117",
"nodeId":"pkg",
"locked":false,
"lockOwner":null,
"dateEffective":null,
"dateExpired":null,
"pendingSnapshot":true,
"conditions":[
{
"conditionType":"condition",
"label":"Age is between ",
"sentence":"Age is between {age_low} and {age_high}",
"segmentList":[
"\"{age_low}\"",
" and ",
"\"{age_high}\""
],
"parmList":[
"20",
"and",
"24"
]
},
{
"conditionType":"condition",
"label":"Education is ",
"sentence":"Education is \"{education}\"",
"segmentList":[
"\"{education}\""
],
"parmList":[
"bachelor"
]
},
{
"conditionType":"condition",
"label":"Employed ",
"sentence":"Employed {employed}",
"segmentList":[
"\"{employed}\""
],
"parmList":[
"true"
]
},
{
"conditionType":"condition",
"label":"Income is at least ",
"sentence":"Income is at least {income} annually",
"segmentList":[
"\"{income}\"",
" annually"
],
"parmList":[
"25000.00",
"annually"
]
},
{
"conditionType":"condition",
"label":"Number of loans less than ",
"sentence":"Number of loans less than {loans}",
"segmentList":[
"\"{loans}\""
],
"parmList":[
"3"
]
},
{
"conditionType":"condition",
"label":"Savings between ",
"sentence":"Savings {savings_low} and {savings_high}",
"segmentList":[
"\"{savings_low}\"",
" and ",
"\"{savings_high}\""
],
"parmList":[
"160",
"and",
"200"
]
}
],
"actions":[
{
"label":"Decision is ",
"sentence":"Decision is \"{decision}\"",
"segmentList":[
"\"{decision}\""
],
"parmList":[
"OK"
]
},
{
"label":"Additional action: ",
"sentence":"Additional action: \"{action}\"",
"segmentList":[
"\"{action}\""
],
"parmList":[
"Reference"
]
}
]
}
|
- 200 OK—Response body provided
- 401 Unauthorized—APIToken not valid
- 403 Forbidden—User does not have permission for the specified tenant ID, or does not have the correct permission for this operation.
- 404 Not Found—could not find specified rule ID.
- 503 —Service Unavailable
|
User must have RULE_VIEW permission
Optional Parameter:
&version=xxx (specifies an earlier version of the rule)
Description of the results:
- conditionType—Either "condition" or "label". Label is used for operators like "and", "or", "not"
- sentence—The original sentence from the template
- segmentList—The original parameters used (eg, "{age}") and any intervening text separated in segments.
- parmList—The substituted variables (for example, "20")
Note: Use Query Parameters to fetch the type of each parameter (eg, "age", "name", etc), any constraints and any drop-down values. This information is not repeated for each condition/action but can be queried separately and applied to control what the user is able to type for each value.
|
Query Decision Table Body
|
GET
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/decisiontablebody/{ruleId}
|
N/A
|
[+]Show
{
"ruleId": "2e11aaa7-12c4-4cf2-8a74-4dbfcf8ed76e",
"ruleType": "DECISION_TABLE",
"extRuleId": "DT-208",
"name": "test dt 2",
"description": "",
"phase": "1st",
"calendarId":"Calendar_117",
"nodeId": "pkg",
"salience": 100000,
"bcLevel": 1,
"locked": false,
"lockOwner": null,
"dateEffective": null,
"dateExpired": null,
"pendingSnapshot": true,
"conditions": [
{
"header": "Debt is less than",
"sentence": "Debt is less than {debt}",
"factType": "Debt is less than {debt}",
"factField": null,
"constraintValueType": 5,
"segmentList": ["\"{debt}\""]
},
{
"header": "Age is between",
"sentence": "Age is between {age_low} and {age_high}",
"factType": "Age is between {age_low} and {age_high}",
"factField": null,
"constraintValueType": 5,
"segmentList": [
"\"{age_low}\"",
" and ",
"\"{age_high}\""
]
}
],
"actions": [
{
"header": "Decision is",
"sentence": "Decision is \"{decision}\"",
"segmentList": ["\"{decision}\""]
},
{
"header": "Stop processing",
"sentence": "Stop processing",
"segmentList": ["Stop processing"]
}
],
"data": [ [
null,
"DTR-209",
"",
"33333",
"22",
"and",
"23",
"OK",
"Stop processing"
]]
}
|
- 200 OK—Response body provided
- 401 Unauthorized—APIToken not valid
- 403 Forbidden—User does not have permission for the specified
tenant ID, or does not have the correct permission for this operation.
- 404 Not Found—could not find specified rule ID.
- 503 —Service Unavailable
|
User must have RULE_VIEW permission
Optional Parameter:
- &version=<xxx> (specifies an earlier version of the rule)
Description of the results:
This query will return the condition and action columns to be shown in a decision table, along with the substitution data that makes up each row.
For both "condition" and "actions", the following is returned:
- sentence—The original sentence from the template: Health is "{health}"
- segmentList—The original parameters used (eg, "{age}") and any intervening text separated in segments.
Example: [ "Health is", "{health}" ]
Note: Use Query Parameters to fetch the type of each parameter (eg, "age", "name", etc), any constraints and any drop-down values. This information is not repeated for each condition/action but can be queried separately and applied to control what the user is able to type for each value.
The actual decision table data is returned as a two dimensional array representing the rows and columns of the decision table. The first column is always "NULL" as it represents the generated drools ID and is not modifiable by the user.
|
Create Rule
|
POST
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/rule
|
[+]Show
{
"ruleType":"DECISION_TABLE",
"name":"My New Rule",
"description":"My Description",
"phase":"My Phase",
"calendarId":"Calendar_117",
"nodeId":"pkg",
"dateEffective":234324234334,
"dateExpired":32434323434
}
|
[+]Show
{
"ruleId":"f22d35f6-e31e-41f2-8e62-97864c47579a",
"extRuleId":"DT-163",
"ruleType":"DECISION_TABLE",
"name":"My New Rule",
"description":"My Description",
"phase":"My Phase",
"calendarId":"Calendar_117",
"nodeId":"pkg",
"dateEffective":234324234334,
"dateExpired":32434323434
}
|
- 201 Created—Response body provided
- 401 - Unauthorized—APIToken not valid
- 403 - Forbidden—User does not have permission for the specified tenant ID, or does not have proper permission to perform this operation.
- 422 - Unprocessable Entry—Field Validation Error
[+]Show
{
"message": "Validation Failed",
"errors": [
{
"code" : "1000",
"field" : "ruleType",
"message": "ruleType must be either DECISION_TABLE or LINEAR"
},
{
"code" : "1001",
"field" : "phase",
"message": "phase is not valid"
},
{
"code" : "1002",
"field" : "calendarId",
"message": "calendarId is not valid"
},
{
"code" : "1003",
"field" : "nodeId",
"message": "nodeId is not valid. Must be either pkg or a
node ID that is valid for this user"
},
{
"code" : "1004",
"field" : "date",
"message": "dateExpired is before dateEffective"
}
]
}
|
User must have RULE_CREATE and RULE_VIEW permission
- ruleType—DECISION_TABLE or LINEAR
- nodeId—pkg to create at package level, otherwise the node ID returned in Query Business Hierarchy.
- dateEffective—null or timestamp (ms since EPOCH)
- dateExpired—null or timestamp (ms since EPOCH)
|
Lock Rule
|
GET
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/lockrule/{ruleId}
|
N/A
|
N/A
|
- 204 No Content—Request was successful
- 401 Unauthorized—APIToken not valid
- 403 Forbidden—User does not have permission for the specified tenant ID, or does not have the correct permission for this operation.
- 404 Not Found—could not find specified package ID or rule ID.
- 412 Precondition failed—another user holds the lock for this resource
- 503—Service Unavailable
|
Must have RULE_VIEW and RULE_MODIFY permission.
User can LOCK (obtain exclusive access) to a rule by issuing this API. The LOCK will be in effect until UNLOCKED by the user, or until the user's APIToken times out (session timeout, default 30 min). A lock is required to modify or delete the rule.
|
Unlock Rule
|
GET
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/rule/{ruleId}
|
[+]Show
To modify something in rule summary (name, phase, etc):
{
"name":"New Name",
"description":"New Desc",
"phase":"New Phase",
"calendarName":"New cal",
"dateEffective":99999999999,
"dateExpired":99999999999
}
|
[+]Show
{
"ruleId":"f22d35f6-e31e-41f2-8e62-97864c47579a",
"extRuleId":"DT-163",
"ruleType":"DECISION_TABLE",
"name":"New Name",
"description":"New Description",
"phase":"New Phase",
"calendarName":"New cal",
"nodeId":"pkg",
"dateEffective":99999999999,
"dateExpired":99999999999
}}
|
- 200 Successful—Response body provided
- 401 Unauthorized—APIToken not valid
- 403 Forbidden—User does not have permission for the specified tenant ID, or does not have proper permission to perform this operation.
- 404 Not Found—could not find specified package ID or rule ID.
- 412 Precondition Failed—Rule was not locked first
- 422 Unprocessable Entry—Field Validation Error
[+]Show
{
"message": "Validation Failed",
"errors": [
{
"code" : "1000",
"field" : "phase",
"message": "phase is not valid"
},
{
"code" : "1001",
"field" : "calendarName",
"message": "calendarName is not valid"
},
{
"code" : "1002",
"field" : "date",
"message": "dateExpired is before dateEffective"
}
]
}
|
User must have RULE_MODIFY and RULE_VIEW permission. User must have rule LOCKED. The following fields can modified on the rule summary. Any other fields specified will be ignored:
- name
- description
- phase
- calendar
- effective date
- expired date
|
Modify Rule
|
PUT
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/rule/{ruleId}
|
To modify something in rule summary (name, phase, etc):
[+]Show
{
"name":"New Name",
"description":"New Desc",
"phase":"New Phase",
"calendarId":"Calendar_117",
"dateEffective":99999999999,
"dateExpired":99999999999
}
|
[+]Show
{
"ruleId":"f22d35f6-e31e-41f2-8e62-97864c47579a",
"extRuleId":"DT-163",
"ruleType":"DECISION_TABLE",
"name":"New Name",
"description":"New Description",
"phase":"New Phase",
"calendarId":"Calendar_117",
"nodeId":"pkg",
"dateEffective":99999999999,
"dateExpired":99999999999
}}
|
- 200 Successful—Response body provided
- 401 Unauthorized—APIToken not valid
- 403 Forbidden—User does not have permission for the specified tenant ID, or does not have proper permission to perform this operation.
- 404 Not Found—could not find specified package ID or rule ID.
- 412 Precondition Failed— Rule was not locked first
- 422 Unprocessable Entry—Field Validation Error
[+]Show
{
"message": "Validation Failed",
"errors": [
{
"code" : "1000",
"field" : "phase",
"message": "phase is not valid"
},
{
"code" : "1001",
"field" : "calendarName",
"message": "calendarName is not valid"
},
{
"code" : "1002",
"field" : "date",
"message": "dateExpired is before dateEffective"
}
]
}
|
User must have RULE_MODIFY and RULE_VIEW permission. User must have rule LOCKED. The following fields can modified on the rule summary. Any other fields specified will be ignored:
- name
- description
- phase
- calendar
- effective date
- expired date
|
Modify LINEAR rule body
|
PUT
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/linearrulebody/{ruleId}<br/>
Optional parameter:
- ?checkInComment=My change (check in comment appears in audit tab and package history tab for the rule)
|
[+]Show
{
"conditions":[
{
"conditionType":"condition",
"label":"Age is between ",
"sentence":"Age is between {age_low} and {age_high}",
"segmentList":[
"\"{age_low}\"",
" and ",
"\"{age_high}\""
],
"parmList":[
"20",
"and",
"24"
]
}
],
"actions":[
{
"label":"Decision is ",
"sentence":"Decision is \"{decision}\"",
"segmentList":[
"\"{decision}\""
],
"parmList":[
"OK"
]
}
]
}
|
[+]Show
{
"ruleId":"a60416af-80a9-4378-be58-785c12b3ba8e",
"ruleType":"LINEAR",
"extRuleId":"Rule-100",
"name":"1st Date",
"description":"Basic criteria",
"phase":"1st",
"calendarId":"Calendar_117",
"nodeId":"pkg",
"locked":true,
"lockOwner":user01,
"dateEffective":null,
"dateExpired":null,
"pendingSnapshot":true,
"conditions":[
{
"conditionType":"condition",
"label":"Age is between ",
"sentence":"Age is between {age_low} and {age_high}",
"segmentList":[
"\"{age_low}\"",
" and ",
"\"{age_high}\""
],
"parmList":[
"20",
"and",
"24"
]
}
],
"actions":[
{
"label":"Decision is ",
"sentence":"Decision is \"{decision}\"",
"segmentList":[
"\"{decision}\""
],
"parmList":[
"OK"
]
}
]
}
|
- 200 Successful—Response body provided
- 401 Unauthorized—APIToken not valid
- 403 Forbidden—User does not have permission for the specified tenant ID or package ID, or does not have proper permission to perform this operation.
- 404 Not Found—could not find specified rule ID.
- 412 Precondition Failed—Rule was not locked first
- 422 Unprocessable Entry—Rule does not validate
[+]Show
{
"message": "Validation Failed",
"errors": [
{
"message": "Validation error 1"
},
{
"message": "Validation error 2"
}
]
}
|
User must have RULE_MODIFY permission. User must have rule LOCKED. To modify something in LINEAR rule body, pass entire rule body (all conditions/actions), regardless of whether they were updated or not (eg, this is a total replacement of rule body). If the change causes the rule to not validate, a 422 will be returned with a list of "compiler errors". The changes have still been committed.
|
Modify DECISION TABLE rule body
|
PUT
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/decisiontablebody/{ruleId}<br/>
Optional parameter:
- ?checkInComment=My change (check in comment appears in audit tab and package history tab for the rule)
|
To modify condition/action columns and row data, pass in "conditions", "actions" and "data" elements. If "conditions" or "actions" are not passed, then no changes will be made. "data" must always be passed.
If only "data" is changing (values changed, new rows inserted, other rows deleted, etc), just pass in the changed "data" structure (see below).
[+]Show
"conditions": [
{
"header": "Debt is less than",
"sentence": "Debt is less than {debt}",
"factType": "Debt is less than {debt}",
"factField": null,
"constraintValueType": 5,
"segmentList": ["\"{debt}\""]
},
{
"header": "Age is between",
"sentence": "Age is between {age_low} and {age_high}",
"factType": "Age is between {age_low} and {age_high}",
"factField": null,
"constraintValueType": 5,
"segmentList": [
"\"{age_low}\"",
" and ",
"\"{age_high}\""
]
}
],
"actions": [
{
"header": "Decision is",
"sentence": "Decision is \"{decision}\"",
"segmentList": ["\"{decision}\""]
},
{
"header": "Stop processing",
"sentence": "Stop processing",
"segmentList": ["Stop processing"]
}
],
"data": [ [
null,
"DTR-209",
"",
"33333",
"22",
"and",
"23",
"OK",
"Stop processing"
]]
}
Data changed only
{
"data": [ [
null,
"DTR-209",
"",
"44444",
"33",
"and",
"44",
"OK",
"Stop processing"
]]
}
|
[+]Show
{
"ruleId": "2e11aaa7-12c4-4cf2-8a74-4dbfcf8ed76e",
"ruleType": "DECISION_TABLE",
"extRuleId": "DT-208",
"name": "test dt 2",
"description": "",
"phase": "1st",
"calendarId":"Calendar_117",
"nodeId": "pkg",
"salience": 100000,
"bcLevel": 1,
"locked": false,
"lockOwner": null,
"dateEffective": null,
"dateExpired": null,
"pendingSnapshot": true,
"conditions": [
{
"header": "Debt is less than",
"sentence": "Debt is less than {debt}",
"factType": "Debt is less than {debt}",
"factField": null,
"constraintValueType": 5,
"segmentList": ["\"{debt}\""]
},
{
"header": "Age is between",
"sentence": "Age is between {age_low} and {age_high}",
"factType": "Age is between {age_low} and {age_high}",
"factField": null,
"constraintValueType": 5,
"segmentList": [
"\"{age_low}\"",
" and ",
"\"{age_high}\""
]
}
],
"actions": [
{
"header": "Decision is",
"sentence": "Decision is \"{decision}\"",
"segmentList": ["\"{decision}\""]
},
{
"header": "Stop processing",
"sentence": "Stop processing",
"segmentList": ["Stop processing"]
}
],
"data": [ [
null,
"DTR-209",
"",
"33333",
"22",
"and",
"23",
"OK",
"Stop processing"
]]
}
|
- 200 Successful—Response body provided
- 401 Unauthorized—APIToken not valid
- 403 Forbidden—User does not have permission for the specified tenant ID or package ID, or does not have proper permission to perform this operation.
- 404 Not Found—could not find specified rule ID.
- 412 Precondition Failed—Rule was not locked first
- 422 Unprocessable Entry—Rule does not validate
[+]Show
{
"message": "Validation Failed",
"errors": [
{
"message": "Validation error 1"
},
{
"message": "Validation error 2"
}
]
}
|
User must have RULE_MODIFY and RULE_VIEW permissions. User must have rule LOCKED. To modify something in DECISION TABLE body, pass entire rule body (all conditions/actions/data), regardless of whether they were updated or not (eg, this is a total replacement of rule body). If the change causes the rule to not validate, a 422 will be returned with a list of "compiler errors". The changes have still been committed.
|
Delete Rule
|
DELETE
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/rule/{ruleId}
|
N/A
|
N/A
|
- 204 No Content—returned if successful operation
- 401 Unauthorized—APIToken not valid
- 403 Forbidden—User does not have permission for the specified tenant or does not have proper permission to perform this operation.
- 404 Not Found—could not find specified package ID or rule ID.
- 412 Precondition Failed—Rule was not locked first
- 503—Service Unavailable
|
User must have RULE_DELETE and RULE_VIEW permission. User must have rule LOCKED
|
Validate Rule
|
GET
|
[+]Show
/grs/v1/tenant/{tenantId}/package/{packageId}/validaterule/{ruleId}
|
N/A
|
[+]Show
{
"message": "Validation Failed",
"errors": [
{
"message": "Validation error 1"
},
{
"message": "Validation error 2"
}
]
}
|
- 204 No content—Rule validates successfully
- 401 Unauthorized—APIToken not valid
- 403 Forbidden—User does not have permission for the specified tenant ID, or does not have proper permission to perform this operation.
- 404 Not Found—could not find specified rule ID.
- 422 Unprocessable Entry—Rule does not validate
[+]Show
{
"message": "Validation Failed",
"errors": [
{
"message": "Validation error 1"
},
{
"message": "Validation error 2"
}
]
}
|
User must have RULE_VIEW permission.
|