Enable/Disable Analytic Rules Using Server API
-----------------------------------
Affected Roles: Administrator, Power Users
Related Digital Watchdog VMS Apps: DW Spectrum
Last Edit: June 19, 2025
-----------------------------------
Analytic Event Rules
Sometimes users want to enable or disable an Analytic Event Rule via a camera input signal, I/O module, or soft trigger. For example, users may want to have an Analytics Event Rule be active only when an alarm is armed, soft trigger is pressed, or input from a camera is received. This can be accomplished through an API request.
If you already have the desired Analytics Event Rule set up, skip ahead to the next section.
Create Event Rules to Enable or Disable an Analytics Event
- Visit https://<server_ip>:<server_port>/ec2/getEventRules with a web browser.
- Find and copy the parameters of the Event Rule you would like to control.
For example:
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"eventType": "undefinedEvent",
"eventResourceIds": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"eventCondition": "string",
"eventState": "inactive",
"actionType": "undefinedAction",
"actionResourceIds": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"actionParams": "string",
"aggregationPeriod": 0,
"disabled": false,
"comment": "string",
"schedule": "string",
"system": true
}
- Create an Event Rule with your preferred event trigger (soft trigger, Input Signal on Camera, or I/O module).
- In the Action section, configure the following:
- Do: select “Do HTTP Request”.
- HTTP URL: enter “https://<server_ip>:<port>/ec2/saveEventRule”.
- HTTP Content: enter the body of the API POST request (the parameters from Step 2). Change the value of the “disabled” parameters to false.
Example:
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"eventType": "undefinedEvent",
"eventResourceIds": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"eventCondition": "string",
"eventState": "inactive",
"actionType": "undefinedAction",
"actionResourceIds": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"actionParams": "string",
"aggregationPeriod": 0,
"disabled": false,
"comment": "string",
"schedule": "string",
"system": true
}
- Open the Content type dropdown and select “application/json”.
- Open the Request type dropdown and select “POST”.
- Enter the login and password then apply the changes.
- Create an Event Rule to disable Event Rule A. Set it to be triggered via Soft Trigger, Input Signal on Camera, or I/O module.
- Repeat Step 4. Change the value of the “disabled” parameter in the HTTP Content field to true.
Example:
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"eventType": "undefinedEvent",
"eventResourceIds": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"eventCondition": "string",
"eventState": "inactive",
"actionType": "undefinedAction",
"actionResourceIds": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
],
"actionParams": "string",
"aggregationPeriod": 0,
"disabled": true,
"comment": "string",
"schedule": "string",
"system": true
}
- Repeat Steps 5-7 and apply changes.
______________________________________________________________________________
For More Information or Technical Support
DW Technical Support: https://www.digital-watchdog.com/contact-tech-support/
DW Sales: [email protected] | www.digital-watchdog.com
Rev: 06/25 Copyright © DW. All rights reserved. Specifications and pricing subject to change without notice.