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>/MessageRouting/v2.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 GET /versions 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 all the matching rules version for the given conditions is as follows:

../../_images/file_download1.png

Download rules in a file - HTTP POST Method

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

POST http://<domain>/MessageRouting/v2.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_download2.png

Upload Rules from File

User can upload all or selective versions of a rule.

POST http://<domain>/MessageRouting/v2.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": 256,
    "RuleName": "Demo rule 2",
    "Status": "Success",
    "Message": "Rules created successfully with rule id: 312 and topic: 6025a1be-e7ec-4eed-855e-aa527edef131.room1.NEXUS1.*"
  },
  {
    "RuleID": 253,
    "RuleName": "Demo Feature rule _JR1",
    "Status": "Error",
    "Message": "Rule name already exist"
  },
  {
    "RuleID": 252,
    "RuleName": "Demo Feature rule _JR",
    "Status": "Error",
    "Message": "Rule name already exist"
  },
  {
    "RuleID": 154,
    "RuleName": "blanktest3",
    "Status": "Error",
    "Message": "Rule name already exist"
  },
  {
    "RuleID": 152,
    "RuleName": "Demo rule buffer _JR",
    "Status": "Error",
    "Message": "Rule name already exist"
  },
  {
    "RuleID": 104,
    "RuleName": "MRRule2",
    "Status": "Error",
    "Message": "Rule name already exist"
  },
  {
    "RuleID": 103,
    "RuleName": "MRRule1",
    "Status": "Error",
    "Message": "Rule name already exist"
  },
  {
    "RuleID": 97,
    "RuleName": "blanktest2",
    "Status": "Error",
    "Message": "Rule name already exist"
  },
  {
    "RuleID": 96,
    "RuleName": "blanktest1",
    "Status": "Error",
    "Message": "Rule name already exist"
  }
]

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_upload1.png