Business Rule¶
/api/repositories/{repository}/entities/{entityID}/businessrules/{ruleID}
| Parameter | Type | Purpose |
|---|---|---|
| repository | string | The name of the Repository the entity is in |
| entityID | int | The ID of the Entity the rule belongs to |
| ruleID | int | The ID of the desired rule |
-
GET/api/repositories/(string: repository)/entities/(int: entityID)/businessrules/(int: ruleID)¶ Get the details of the business rule from the Repository
-
POST/api/repositories/(string: repository)/entities/(int: entityID)/businessrules/(int: ruleID)¶ Edit or run the business rule
JSON Parameters: - body – The request body
-
DELETE/api/repositories/(string: repository)/entities/(int: entityID)/businessrules/(int: ruleID)¶ Delete the business rule
Show¶
GET /api/repositories/jupiter/entities/1/businessrules/1 HTTP/1.1
Accept: application/json
| Response Code | Reason |
|---|---|
| 200 | No error |
| 500 | Server error |
The underlying row data of a business rule for the Entity can be returned in a JSON key/value pair by setting the external JSON format parameter. This allows access by different external tools that requires the JSON data in a key/value pair instead of standard array of row data with columns names defined separately.
The response is a Standard Response, with the details of the business rule. If external JSON format parameter was set then the details of the business rule will be returned in a JSON key/value pair format.
Edit¶
The request requires a Standard Request packet. The command field must be edit; see the edit command for the contents of the request.
The request may return any of the following status codes:
| Response Code | Reason |
|---|---|
| 200 | Success |
| 400 | Invalid request body |
| 400 | No rule details given |
| 400 | Invalid command |
| 400 | No data received |
| 500 | Server error |
POST /api/repositories/jupiter/entities/1/businessrules/1 HTTP/1.1
Content-Type: application/json
{
"command": "edit",
"data": {
"NAME" : "Rule4",
"DESCRIPTION" : "description",
"ENABLED" : "1",
"EXPRESSION" : "attr2>0",
"FILTER_EXPRESSION" : "new2>9",
"GROUP_EXPRESSION" : "new5=0",
"GROUP_LIMIT" : "0",
"AGGREGATE_EXPRESSION" : "acc_id<0",
"AGGREGATE_METHOD" : "0",
"PRIORITY" : "1",
"THRESHOLD" : "100",
"INDEX_CONTROL":"",
"INDEX_THRESHOLD":"",
"RULE_KEYWORD_ID_LIST":"1 0:2 1"
}
}
The table below shows all the fields that are available for edit.
| Field | Description | Values |
|---|---|---|
| EXPRESSION | Humanized expression | |
| THRESHOLD | Numerical threshold value | Between 0 to 100 |
| ENABLED | Rule is enabled or disabled | 0 (Disabled) or 1 (Enabled) |
| DESCRIPTION | Description of the library rule | |
| FILTER_EXPRESSION | Humanized expression for filter | |
| AGGREGATE_EXPRESSION | Humanized aggregate expression | |
| GROUP_EXPRESSION | Humanized group expression | |
| GROUP_LIMIT | Numerical value for group limit | |
| AGGREGATE_METHOD | Name of aggregate method | See below for values |
| INDEX_CONTROL | Numeric value | See below for values |
| INDEX_THRESHOLD | Valid only if INDEX_CONTROL is 2 | |
| PRIORITY | Numeric value between 1 and 10 | |
| RULE_KEYWORD_ID_LIST | Array of keyword IDs | List of <category_id keyword_id> separated by colon. A value of 0 in keyword_id fields specify that the rule is attached to all the keywords of that category. |
All the fields are optional.
Aggregate Method
| Value | Method |
|---|---|
| 0 | Sum |
| 1 | Average |
| 2 | Maximum |
| 3 | Minimum |
| 4 | Count |
Index Control
| Value | Method |
|---|---|
| 0 | Normal |
| 1 | Unlimited |
| 2 | Limited |
If the request is successful, the response will contain the URL of the updated business rule.
Run¶
POST /api/repositories/jupiter/entities/1/businessrules/1 HTTP/1.1
Content-Type: application/json
{
"command": "run",
"data": {
"ENTITY": "EID",
"OPTION": "Analysis options (See below)",
"RULE_IDS": [
"EID AID RID"
]
}
}
The request requires a Standard Request packet. The command field must be run; see the run command for the contents of the request.
The request may return any of the following status codes:
| Response Code | Reason |
|---|---|
| 200 | Success |
| 400 | Invalid request body |
| 400 | No rule details given |
| 400 | Invalid command |
| 400 | No data received |
| 500 | Server error |
The response will contain the URL of the scheduled job.
Delete¶
DELETE /api/repositories/jupiter/entities/1/businessrules/1 HTTP/1.1
The business rule will be deleted. The request may return any of the following status codes:
| Response Code | Reason |
|---|---|
| 200 | Success |
| 400 | Expected array of rules(s) within request body |
| 400 | No rule(s) found within request body |
| 400 | No data received |
| 500 | Invalid parameters |
| 500 | Server error |
If the delete is successful, the response will contain a url pointing at the Entity that owned the rule.