Occurs when the server receives an HTTP request from an external system such as an alarm system, access control device, or monitoring system. This is a default event.
DW Spectrum allows third-party systems and devices to send an HTTP string known as a "createEvent" API call. The CreateEvent request must follow the proper format in order to be read by the server, and the event fields in the rule must match the corresponding fields in the HTTP request to be acted upon.
Together with the "Do HTTP Request" action, which can send an HTTP request, you can create bidirectional API communication between DW Spectrum and other software systems. A Generic Event can automatically replace the appropriate action parameter placeholders used in a "Do HTTP Request" with the corresponding parameter's value. Full server API documentation can be accessed on any installed server from http://<serveripaddress>:<servernetworkport>/static/api.xml. See "Using a Server's Web Interface" for more information.
Note: Values in the event field are case-sensitive, and an empty string functions as a wildcard, where any value is considered a match.
Basic Parameters
Each request contains the following fields:
•Source
•Caption
•Description
•Metadata – Used to pass a device identifier that will specify devices the event is limited to (cameras, I/O modules, etc). To obtain the device identifier:
Open the device context menu and click Device Settings. In the General tab, the device identifier will be displayed as Camera/Device ID. The device identifier should be passed in the following format: {"cameraRefs":["<id>"]}. In HTML encoding it will look like this: {%22cameraRefs%22:[%22<id>%22]}.
IMPORTANT: It is necessary to specify a device if the generic event is linked to a notification, and the "Force Acknowledgment" option is required. In this case once the notification is acknowledged, a Bookmark will be created and linked to the specified device. See "Show Notifications" for details.
•Occurs/Starts/Stops – This is an optional field for the "State". If there is no "State" field in the HTTP request, the event is considered instant. If specified, the event is considered continuous and the rule requires a State=Active (Start) or State=Inactive (Stop) attribute. If a Generic Event containing State=Active is received, the resulting action will continue until the server receives a Generic Event with the same parameters that contains State=Inactive.
Note: If a continuous action such as "device recording" or "repeat sound" is bound to an instant Generic Event (one without a State field), the rule will not work. (See "Configuring Event Rules" for more information about continuous and instant events.)
Example
http://127.0.0.1:7001/api/createEvent?source=%22Door%22&caption=%22Knock%20Knock%22&description=%22Visitor!%22&metadata={%22cameraRefs%22:[%22066fbf9c-2e11-a501-6e15-dfb0fb97c7cb%22]} This HTTP request:
•Sends data to a server at IP Address 127.0.0.1 and Port 7001,
•Source –"Door"
•Caption – "Knock Knock"
•Description – "Visitor!"
•State – Not used, so instant
•Device Identifier – 066fbf9c-2e11-a501-6e15-dfb0fb97c7cb.
Remember, fields in the Generic Event must match the corresponding HTTP request and are case-sensitive. For instance, for an event configured as Source "foo", Caption "bar", and Description "" (empty):
An HTTP request with the following data WILL trigger a Generic Event: |
An HTTP request with the following data will NOT trigger Generic Event: |
Source – "foo12345" (contains "foo") |
Source – "Foo12345" (contains "Foo" instead of "foo") |
Caption – "bartender" (contains "bar") |
Caption – "batender" (does not contain "bar") |
Description – (empty string means all values match) |
Description – "Lorem ipsum dolor sit amet" (empty string means all values match). |
Advanced Parameters
Omit Logging – When checked, the generic event will not be added to the Event log. This option allows an action that is trigger in rapid succession or with a very high frequency to be performed without a database call or database storage that would cause undesirable "spamming" of the Event Log. (Note that even if the "Omit logging" checkbox is enabled, a Generic event with a "Write to log" Action will still appear in the Event Log).
Why Event may work incorrectly
HTTP request is not correctly written. Refer to the server API.
Request is filtered out. Try clearing all fields (Source, Caption, Description) and trigger the HTTP request again.
HTTP request is bound to a continuous type of action but does not contain the "State" field.
A device is not specified yet the event is linked to a notification and the "Force Acknowledgment" option is set.
Global notification for this event is disabled.