Rules Download and Upload

Download Rules in a File

User can get all the matching rules version for the given conditions in a file.

GET http://<domain>/ActionModule/v1.0/files/export/rules

Below are the query parameters that can be used.

Parameter

Required

Values

Description

rule_id

false

number

List of comma-separated rule id to be downloaded.

format

false

string

File format (zip or json). Default format is zip.

Click on API in swagger and hit Try it out! button , it will display the link to download “rules.json” file as below :

The swagger image for the download option is mentioned below:

../../_images/file_download1.PNG

Download rules in a file - HTTP POST Method

Rules file can be downloaded in a file using HTTP post method. It is downloaded in zipped format.

POST http://<domain>/ActionModule/v1.0/files/export/rules

Below are the query parameters that can be used.

Parameter

Required

Values

Description

body

true

JSON object

List of rule ID to be downloaded.

Click on API in swagger and hit Try it out! button , it will display the link to download “rules.json” file as below :

The swagger image for the download option is mentioned below:

../../_images/file_download.png

Upload Rules from File

User can upload all or selective versions of a rule.

POST http://<domain>/ActionModule/v1.0/files/import/rules

Below are the path parameters that can be used.

Parameter

Required

Values

Description

rule_id

false

number

List of comma-separated rule id to be uploaded.

option

false

String

Possible values are overwrite or skip. In case of overwrite , if same rule name exist , it will be deleted and new rule with the same name created. In case of skip, same rule name will be skipped.

rules

true

file

Downloaded file either zipped or json format.

Click on GET /files/rules api in swagger and hit Try it out! button , it will display details of upload as below :

[
 {
   "RuleID": 443,
   "RuleName": "TestRuleSOS-MQTT",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 603"
 },
 {
   "RuleID": 301,
   "RuleName": "HTTPAllPost mr",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 604"
 },
 {
   "RuleID": 221,
   "RuleName": "RDBMSRule",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 605"
 },
 {
   "RuleID": 182,
   "RuleName": "Email 1",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 606"
 },
 {
   "RuleID": 181,
   "RuleName": "StreamSummary",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 607"
 },
 {
   "RuleID": 141,
   "RuleName": "Test Rule100",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 608"
 },
 {
   "RuleID": 121,
   "RuleName": "RDBMSRuleSchemaCreation1",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 609"
 },
 {
   "RuleID": 101,
   "RuleName": "RDBMSRuleSchemaCreation",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 610"
 },
 {
   "RuleID": 81,
   "RuleName": "Test Rule15",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 611"
 },
 {
   "RuleID": 61,
   "RuleName": "S_AlarmTableUpdate",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 612"
 },
 {
   "RuleID": 22,
   "RuleName": "TestRule71",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 613"
 },
 {
   "RuleID": 21,
   "RuleName": "TestRule7",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 614"
 },
 {
   "RuleID": 1,
   "RuleName": "Test Rule11",
   "Status": "Success",
   "Message": "Rule created successfully with rule id: 615"
 }
]

Note

  • It displays in descending manner based on rule ID.

Below are the description of each parameters of the above JSON.

Parameter

Values

Description

RuleID

number

Rule id.

RuleName

string

Rule name.

status

string

Rule upload status (Error/Success).

Message

string

Rule upload message.

The swagger image for import all rules is as follows:

../../_images/file_upload.png