Jump to: navigation, search

Rules

API Method Syntax Request Body Response Body HTTP Status Codes Notes
Query Rules in Package GET [+]Show N/A [+]Show
  • 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 N/A [+]Show
  • 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 N/A [+]Show
  • 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 [+]Show [+]Show
  • 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
  • 503—Service Unavailable
User must have RULE_CREATE and RULE_VIEW permission
  • ruleTypeDECISION_TABLE or LINEAR
  • nodeIdpkg 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 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 [+]Show [+]Show
  • 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
  • 503—Service Unavailable
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 To modify something in rule summary (name, phase, etc): [+]Show [+]Show
  • 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
  • 503—Service Unavailable
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

Optional parameter:

  • ?checkInComment=My change (check in comment appears in audit tab and package history tab for the rule)
[+]Show [+]Show
  • 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
  • 503—Service Unavailable
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

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
[+]Show
  • 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
  • 503—Service Unavailable
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 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 N/A [+]Show
  • 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
  • 503—Service Unavailable
User must have RULE_VIEW permission.
This page was last edited on July 30, 2015, at 13:17.
Comments or questions about this documentation? Contact us for support!