When managing complex security setups in the VMS, you might need to enable or disable multiple Event Rules simultaneously based on a single trigger (such as a physical I/O signal change or a Soft Trigger).
While standard REST API requests typically modify one object at a time, you can use JSON-RPC batch requests paired with the Do Internal HTTPS Request action to update multiple rules at once using only two Events (one to enable, one to disable). Full documentation can be found HERE.
Prerequisites
Before configuring the rules, you must gather the unique IDs of the Event Rules you want to control. You can obtain these IDs by querying the server's API or following the standard documentation for retrieving rule attributes.
Step-by-Step Configuration
To manage a group of rules simultaneously, you must create two new Event Rules in the Rules Engine: one for enabling the group and one for disabling it.
Rule 1: Enable Multiple Event Rules
Open the Rules Engine in your VMS client and create a new rule.
Set the Event trigger to your desired input (for example,
Input Signal on Deviceor aSoft Trigger).Set the Action to Do Internal HTTPS request.
Configure the action settings using the parameters below:
| Field | Value |
|---|---|
| Endpoint | /jsonrpc |
| Method | POST |
| Content-Type | application/json |
| Interval of Action | Instant |
Like so:
Paste the following sample JSON structure into the Content body, replacing the example
idvalues in theparamsblocks with your actual Event Rule IDs:
[
{
"jsonrpc": "2.0",
"id": 1,
"method": "rest.v4.events.rules.update",
"params": {
"id": "6008e230-3ed4-4f92-9249-cde4b06d7540",
"enabled": true
}
},
{
"jsonrpc": "2.0",
"id": 2,
"method": "rest.v4.events.rules.update",
"params": {
"id": "cee4c959-914a-458e-b664-263eb838d3bf",
"enabled": true
}
}
]
Rule 2: Disable Multiple Event Rules
Create a second rule in the Rules Engine.
Set the Event trigger to the corresponding deactivation signal.
Set the Action to Do Internal HTTPS request.
Use the same connection settings as Rule 1 (
/jsonrpc,POST,application/json).Paste the following sample JSON structure into the Content body to turn off the same rules:
[
{
"jsonrpc": "2.0",
"id": 1,
"method": "rest.v4.events.rules.update",
"params": {
"id": "6008e230-3ed4-4f92-9249-cde4b06d7540",
"enabled": false
}
},
{
"jsonrpc": "2.0",
"id": 2,
"method": "rest.v4.events.rules.update",
"params": {
"id": "cee4c959-914a-458e-b664-263eb838d3bf",
"enabled": false
}
}
]
Understanding JSON-RPC Conversion Rules
The VMS Server maps its standard REST API endpoints to JSON-RPC methods using predictable formatting rules. If you want to scale this solution to other API features, construct your payloads based on these requirements:
Protocol Version: The
jsonrpcfield must always be exactly"2.0".Request Tracking: The top-level
idfield must be a unique number or string for each request in the batch payload so you can identify the corresponding responses.-
Method Names: Convert the standard HTTP path by replacing all slashes (
/) with dots (.), removing dynamic URL parameters, and appending a suffix based on the HTTP verb:PATCHbecomes.updatePUTbecomes.setDELETEbecomes.deleteGET(for a single object) becomes.oneGET(for a list/map) becomes.allPOSTbecomes.create(or the suffix can be omitted entirely)
Comments
0 comments
Article is closed for comments.