Library Entity Business Rule¶
/api/repositories/{repository}/library/entities/{libraryID}/businessrules/{ruleID}
| Parameter | Type | Purpose |
|---|---|---|
| repository | string | The name of the Repository |
| libraryID | int | The ID of the library entity |
| ruleID | int | The ID of the rule |
Get/Post¶
-
GET/api/repositories/(string: repository)/library/entities/(int: libraryID)/businessrules/(int: ruleID)¶ Get details of a business rule for a Library Entity. The GET request supports page and pageSize parameters on the URL. If you require a subset of this data (filtering, sorting, or columns), POST to this url with the standard request body.
GET /api/repositories/jupiter/library/entities/2/businessrules/1 HTTP/1.1
Accept: application/json
| Response Code | Reason |
|---|---|
| 200 | No error |
| 500 | Server error |
The response will be a Standard Response. The columns array will contain the following:
| Human Name | Column Name | Description |
|---|---|---|
| Name | actual_name | Test name. |
| Description | actual_description | Test Description. |
| Threshold | threshold_percent | Compliance ThresholdPercentage. |
| Enabled | _model_check | True if the test is enabled. |
| Priority | actual_priority | Priority of the rule. |
| Priority Description | _priority_description | Description of the priority |
| Index Control | _model_index_control | Compliance Threshold Percentage. |
| Index Threshold | _model_index_threshold | Compliance Threshold Percentage. |
| Expression | predicate | The Business Rule Test. |
| Filtering | _model_is_filtering | Are the rows being filtered. |
| Filter Expression | _model_filter_predicate | The Business Rule Filter. |
| Grouping | _model_is_grouping | Are the rows being grouped. |
| Group Function | _model_group_function | Business Rule Group-by function |
| Aggregating | _model_is_aggregating | Are the rows being aggregated |
| Aggregate Method | _model_aggregate_method | Method used to aggregate. |
| Aggregate Function | _model_aggregate_function | Business Rule Aggregate function |
| Created By | CREATED_BY | Who created this business rule. |
| Date Created | _created_date | When this business rule was created. |
| Edited By | EDITED_BY | Who changed this business rule. |
| Date Changed | _edited_date | When this business rule was changed. |
| XML | actual_predicate | Business Rule represented in XML. |
| Sequence Number | seqno | Sequence number identifying the rule. |
| Identifier | actual_uuid | The rule identifier. |
| Local identifier | _local_identifier | A unique identifier for the rule. |
| Rule Categories | _rule_categories | Business Rule categories. |
| Associations | _associations | Are there any associations for this rule. |
If there isn’t a business rule matching the rule ID, or the Library Entity does not exist, the rows array will be empty.
If the rule does exist, the rows array will have a single element:
{
"dataRow": [
"MyRule",
"",
"100",
"yes",
"1",
"{}",
"Normal",
"",
"<expr><text>Row <> 0</text><ne><var>:rowid:</var><int>0</int></ne></expr>\r\r\n",
"no",
"",
"no",
"",
"no",
"",
"",
"bob",
"2014/11/06 12:25:13",
"",
"",
"<expr><text>Row <> 0</text><ne><var>:rowid:</var><int>0</int></ne></expr>\r\r\n",
"1",
"c1ca546a-5402-4f96-a428-251b6496448f",
"",
"",
"1"
],
"metadata": {
"url": "/api/repositories/jupiter/library/entities/2/businessrules/1"
}
}
Add¶
-
POST/api/repositories/(string: repository)/library/entities/(int: libraryID)/businessrules/(int: ruleID)¶ Add a business rule for a Library Entity.
POST /api/repositories/jupiter/library/entities/2/businessrules HTTP/1.1
Content-Type: application/json
{
"command": "add",
"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"
}
}
| Response Code | Reason |
|---|---|
| 204 | Success |
| 400 | No command specified |
| 400 | Invalid command |
| 400 | No data received |
| 400 | Error converting data to Tcl |
| 400 | Error executing command |
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 | Name of the library rule | 0 or 1 |
| 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 | 0 to 4. Here is the mapping of the number to aggregate method:0-Sum 1-Average 2-Maximum 3-Minimum and 4-Count |
| INDEX_CONTROL | Numeric value | 0 1 or 2. Mapping of number to index_control: 0-Normal 1-Unlimited and 2-Limited. |
| 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. |
Edit¶
-
POST/api/repositories/(string: repository)/library/entities/(int: libraryID)/businessrules/(int: ruleID)¶ Edit a business rule for a Library Entity.
POST /api/repositories/jupiter/library/entities/2/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"
}
}
| Response Code | Reason |
|---|---|
| 204 | Success |
| 400 | No command specified |
| 400 | Invalid command |
| 400 | No data received |
| 400 | Error converting data to Tcl |
| 400 | Error executing command |
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 | Name of the library rule | 0 or 1 |
| 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 | 0 to 4. Here is the mapping of the number to aggregate method:0-Sum 1-Average 2-Maximum 3-Minimum and 4-Count |
| INDEX_CONTROL | Numeric value | 0 1 or 2. Mapping of number to index_control: 0-Normal 1-Unlimited and 2-Limited. |
| 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. |
Delete¶
-
DELETE/api/repositories/(string: repository)/library/entities/(int: libraryID)/businessrules/(int: ruleID)¶ Delete a library business rule from a library entity.
DELETE /api/repositories/jupiter/library/entities/2/businessrules/1 HTTP/1.1
Content-Type: application/json
{
"disassociate": ["4"]
}
The disassociate key, if specified, will have an array of Entity IDs to disassociate on deleting the library business rule.
When a library business rule is deleted, it may be disassociated from any Entity it is associated with. If a rule is not disassociated from the Entity, the rule is also deleted from the Entity as well as from the library.
| Response Code | Reason |
|---|---|
| 204 | Success |