Returns a list of all rules belonging to an account as per the specified criteria. This API is paginated and returns 20 groups by default. A rule is uniquely identified by a 'rule_key'. This key should be used in all the other API referencing a particular rule.
Param name | Description |
---|---|
page optional |
Page number of results to be fetched, Default 1 Value: Must be Integer. |
per optional |
Number of rule records to be returned in one page, Default 20 Value: Must be Integer. |
order_by optional |
Field on which results should be sorted Value: Must be a String |
order optional |
Order, “asc” or “desc”, in which results should be sorted. Value: Must be a String |
fetch_na_keys optional |
Optional, whether to fetch notification action keys for a rule along with its definition Value: Must be a String |
eval_engine optional |
Optional, specify specific evaluation engine, 0 for Datonis rules and 1 for Edge rules Value: Must be Integer. |
timestamp_format optional |
Format, “str” or “int”, in which timestamps should be returned, Default “int” Value: Must be a String |
search optional |
Keywords based on which rules should be searched. Currently you can search rules on - rule_key or name Value: Must be a String |
scope optional |
Matching condition if multiple keywords are specified for search. Valid values are “all” or “any”. Default is “all” Value: Must be a String |
pretty optional |
Return a pretty formatted response if true, Default is false Value: Must be a Boolean |
field_list optional |
List of fields required in the result. Value: Must be an array of any type |
Request - listing all rules without any criteria curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:DarTKU-eUJ7md2vS-lFroA" https://api.datonis.io/api/v3/rules Response (returns first 20 rules) { "total_count": 4, "page": 1, "rules": [ { "created_at": 1429165920, "enabled": false, "expression": "$event.data.cpu > 0", "name": "Example-RJ-3", "rule_applicability": 3, "rule_applicability_value": "e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7", "rule_key": "33e73fa4f7", "rule_properties": { }, "rule_type": 1, "time_between_triggers": 300, "updated_at": 1432116233, "user_visible_expression": null, "last_trigger_time": "N.A" }, { "created_at": 1426581040, "enabled": true, "expression": "($event.data.cpu > 1)", "name": "CPU Rule", "rule_applicability": 3, "rule_applicability_value": "2f3ebc1cfted1956de1d8tat3be5f66ab7ed27ct", "rule_key": "atc27bfd67", "rule_properties": { }, "rule_type": 1, "time_between_triggers": 60, "updated_at": 1430299095, ...
Request - listing rules by specifying number of rules to be returned at a time (page size) and specific set to be returned (page) curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:DarTKU-eUJ7md2vS-lFroA" -d '{"per":"2","page":"2"}' https://api.datonis.io/api/v3/rules Response (returns page 2 with 2 rules per page) { "total_count": 4, "page": "2", "rules": [ { "created_at": 1448437343, "enabled": true, "expression": "$event.data.temperature > 100", "name": "Temperature monitoring rule", "rule_applicability": 3, "rule_applicability_value": "e28t112bdt,t6fd4btb5e", "rule_key": "f79f7tf6f9", "rule_properties": { "since": 1, "timezone": "Mumbai", "minutes": 5, "utc_offset": 19800 }, "rule_type": 1, "time_between_triggers": 1800, "updated_at": 1448437527, "user_visible_expression": null, "last_trigger_time": "N.A" }, { "created_at": 1448437424, "enabled": true, "expression": "$event.data.voltage > 230", "name": "Voltage Monitoring Rule", "rule_applicability": 2, "rule_applicability_value": "Temp Sensor", "rule_key": "5de74et6cd", "rule_properties": { "since": 1,...
Request - listing rules ordered by a field with string formatted timestamps curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:DarTKU-eUJ7md2vS-lFroA" -d '{"order_by":"name","order":"desc","timestamp_format":"str"}' https://api.datonis.io/api/v3/rules Response (returns groups in the reverse order of their name, with timestamps in string format) { "total_count": 4, "page": 1, "rules": [ { "created_at": "2015/11/25 07:43:44", "enabled": true, "expression": "$event.data.voltage > 230", "name": "Voltage Monitoring Rule", "rule_applicability": 2, "rule_applicability_value": "Temp Sensor", "rule_key": "5de74et6cd", "rule_properties": { "since": 1, "timezone": "Mumbai", "minutes": 5, "utc_offset": 19800 }, "rule_type": 1, "time_between_triggers": 1800, "updated_at": "2015/11/25 07:43:44", "user_visible_expression": null, "last_trigger_time": "N.A" }, { "created_at": "2015/11/25 07:42:23", "enabled": true, "expression": "$event.data.temperature > 100", "name": "Temperature monitoring rule", "rule_applicability": 3, "rule_applicability_value": "e28t112bdt,t6fd4btb5e", "rule_key": "f79f7tf6f9", "rule_properties": { "since": 1, ...
Request - listing rules based on some search criteria with all keywords matching curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:DarTKU-eUJ7md2vS-lFroA" -d '{"search":"Voltage Monitoring"}' https://api.datonis.io/api/v3/rules Response (returns rules containing both keywords 'Voltage' as well as 'Monitoring') { "total_count": 1, "page": 1, "rules": [ { "created_at": 1448437424, "enabled": true, "expression": "$event.data.voltage > 230", "name": "Voltage Monitoring Rule", "rule_applicability": 2, "rule_applicability_value": "Temp Sensor", "rule_key": "5de74et6cd", "rule_properties": { "since": 1, "timezone": "Mumbai", "minutes": 5, "utc_offset": 19800 }, "rule_type": 1, "time_between_triggers": 1800, "updated_at": 1448437424, "user_visible_expression": null, "last_trigger_time": "N.A" } ] }
Request - listing rules based on some search criteria with any of the keywords matching curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:DarTKU-eUJ7md2vS-lFroA" -d '{"search":"Voltage 33e73fa4f7", "scope":"any"}' https://api.datonis.io/api/v3/rules Response (returns rules containing either of the keywords 'Voltage' or 't2514225a7' - In this case one rule matched per keyword) { "total_count": 2, "page": 1, "rules": [ { "created_at": 1429165920, "enabled": false, "expression": "$event.data.cpu > 0", "name": "Example-RJ-3", "rule_applicability": 3, "rule_applicability_value": "e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7", "rule_key": "33e73fa4f7", "rule_properties": { }, "rule_type": 1, "time_between_triggers": 300, "updated_at": 1432116233, "user_visible_expression": null, "last_trigger_time": "N.A" }, { "created_at": 1448437424, "enabled": true, "expression": "$event.data.voltage > 230", "name": "Voltage Monitoring Rule", "rule_applicability": 2, "rule_applicability_value": "Temp Sensor", "rule_key": "5de74et6cd", "rule_properties": { "since": 1, "timezone": "Mumbai", "minutes": 5, "utc_offset": 19800 }, "rule_type": 1, "time_between_triggers": 1800, ...
Request - listing rules along with associated notification action keys curl -X GET -H "Content-Type:application/json" -H "X-Auth-Token:DarTKU-eUJ7md2vS-lFroA" -d '{"fetch_na_keys":"1"}' https://api.datonis.io/api/v3/rules Response (returns rules containing either of the keywords 'Voltage' or 't2514225a7' - In this case one rule matched per keyword) { "total_count": 4, "page": 1, "rules": [ { "created_at": 1429165920, "enabled": false, "expression": "$event.data.cpu > 0", "name": "Example-RJ-3", "rule_applicability": 3, "rule_applicability_value": "e4aa3e35t675fc57ce81f3dd6e2dcdef492at4f7", "rule_key": "33e73fa4f7", "rule_properties": { }, "rule_type": 1, "time_between_triggers": 300, "updated_at": 1432116233, "user_visible_expression": null, "notification_action_keys": [ "99c47515f1" ], "last_trigger_time": "N.A" }, { "created_at": 1426581040, "enabled": true, "expression": "($event.data.cpu > 1)", "name": "CPU Rule", "rule_applicability": 3, "rule_applicability_value": "2f3ebc1cfted1956de1d8tat3be5f66ab7ed27ct", "rule_key": "atc27bfd67", "rule_properties": { }, "rule_type": 1, "time_between_triggers": 60, "updated_at": 1430299095, "user_visible_expression": null, "notification_action_keys": [ "t2e9b13568", ...