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 |
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/v2/rules Response (returns first 20 rules) { "total_count": 4, "page": 1, "rules": [ { "enabled": true, "expression": "$event.data.temperature > 100", "name": "Temperature monitoring rule", "rule_applicability": 3, "rule_applicability_value": "554ed8f4c31f5be2336a173cfa183tbc9ab1b9t2,t42b258f9daef7ee64146651ef1dffc1b441df4t", "rule_key": "9cta36t513", "rule_type": null, "time_between_triggers": 1800, "user_visible_expression": null, "created_at": 1416830206, "updated_at": 1419833101, "last_trigger_time": "N.A" }, { "enabled": true, "expression": "$event.data.voltage < 230", "name": "Voltage monitoring rule", "rule_applicability": 3, "rule_applicability_value": "27ce8667143fa217b3eb9ecbedcbacdc28addt97,16dc891e4b255735d7tafete13e6fdc412628t84", "rule_key": "961c6ectbf", "rule_type": null, "time_between_triggers": 1800, ...
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/v2/rules Response (returns page 2 with 2 rules per page) { "total_count": 4, "page": "2", "rules": [ { "enabled": true, "expression": "$event.data.power < 500", "name": "Power monitoring rule", "rule_applicability": 3, "rule_applicability_value": "27ce8667143fa217b3eb9ecbedcbacdc28addt97,16dc891e4b255735d7tafete13e6fdc412628t84", "rule_key": "t2514225a7", "rule_type": null, "time_between_triggers": 1800, "user_visible_expression": null, "created_at": 1416830206, "updated_at": 1419833101, "last_trigger_time": "N.A" }, { "enabled": true, "expression": "$event.data.pressure > 750", "name": "Pressure monitoring rule", "rule_applicability": 3, "rule_applicability_value": "554ed8f4c31f5be2336a173cfa183tbc9ab1b9t2,t42b258f9daef7ee64146651ef1dffc1b441df4t", "rule_key": "66132eb8c1", "rule_type": null, "time_between_triggers": 1800, ...
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/v2/rules Response (returns groups in the reverse order of their name, with timestamps in string format) { "total_count": 4, "page": 1, "rules": [ { "enabled": true, "expression": "$event.data.voltage < 230", "name": "Voltage monitoring rule", "rule_applicability": 3, "rule_applicability_value": "27ce8667143fa217b3eb9ecbedcbacdc28addt97,16dc891e4b255735d7tafete13e6fdc412628t84", "rule_key": "961c6ectbf", "rule_type": null, "time_between_triggers": 1800, "user_visible_expression": null, "created_at": "2014/11/24 11:56:46", "updated_at": "2014/12/29 06:05:01", "last_trigger_time": "2015/04/13 07:07:55" }, { "enabled": true, "expression": "$event.data.temperature > 100", "name": "Temperature monitoring rule", "rule_applicability": 3, "rule_applicability_value": "554ed8f4c31f5be2336a173cfa183tbc9ab1b9t2,t42b258f9daef7ee64146651ef1dffc1b441df4t", "rule_key": "9cta36t513", "rule_type": null, "time_between_triggers": 1800, "user_visible_expression":...
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/v2/rules Response (returns rules containing both keywords 'Voltage' as well as 'Monitoring') { "total_count": 1, "page": 1, "rules": [ { "enabled": true, "expression": "$event.data.voltage < 230", "name": "Voltage monitoring rule", "rule_applicability": 3, "rule_applicability_value": "27ce8667143fa217b3eb9ecbedcbacdc28addt97,16dc891e4b255735d7tafete13e6fdc412628t84", "rule_key": "961c6ectbf", "rule_type": null, "time_between_triggers": 1800, "user_visible_expression": null, "created_at": 1416830206, "updated_at": 1419833101, "last_trigger_time": 1428908875 } ] }
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 t2514225a7", "scope":"any"}' https://api.datonis.io/api/v2/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": [ { "enabled": true, "expression": "$event.data.voltage < 230", "name": "Voltage monitoring rule", "rule_applicability": 3, "rule_applicability_value": "27ce8667143fa217b3eb9ecbedcbacdc28addt97,16dc891e4b255735d7tafete13e6fdc412628t84", "rule_key": "961c6ectbf", "rule_type": null, "time_between_triggers": 1800, "user_visible_expression": null, "created_at": 1416830206, "updated_at": 1419833101, "last_trigger_time": 1428908875 }, { "enabled": true, "expression": "$event.data.power < 500", "name": "Power monitoring rule", "rule_applicability": 3, "rule_applicability_value": "27ce8667143fa217b3eb9ecbedcbacdc28addt97,16dc891e4b255735d7tafete13e6fdc412628t84", "rule_key": "t2514225a7", "rule_type": null, "time_between_triggers": 1800, "user_visible_expression": null, "created_at": 1416830206, ...
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/v2/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": [ { "enabled": true, "expression": "$event.data.temperature > 100", "name": "Temperature monitoring rule", "rule_applicability": 3, "rule_applicability_value": "554ed8f4c31f5be2336a173cfa183tbc9ab1b9t2,t42b258f9daef7ee64146651ef1dffc1b441df4t", "rule_key": "9cta36t513", "rule_type": null, "time_between_triggers": 1800, "user_visible_expression": null, "notification_action_keys": [ "ca2b7574ac" ], "created_at": 1416830206, "updated_at": 1419833101, "last_trigger_time": 1428908816 }, { "enabled": true, "expression": "$event.data.voltage < 230", "name": "Voltage monitoring rule", "rule_applicability": 3, "rule_applicability_value": "27ce8667143fa217b3eb9ecbedcbacdc28addt97,16dc891e4b255735d7tafete13e6fdc412628t84", "rule_key": "961c6ectbf", "rule_type": null, "time_between_triggers": 1800, "user_visible_expression": null, "notification_action_keys": [ "54f8938b3t" ...