5.10.2 api log subscribe
The /api/log/subscribe function helps you create a subscription channel and returns a unique identifier to be used for subsequent dialling of the /api/log/pull or /api/log/unsubscribe function.
Each subscription channel contains an event queue of its own. All the new events that match the channel filter (filter parameter) are added to the channel queue and read using the /api/log/pull function.
At the same time, the device keeps the event history queue (last 10000 events) in its internal memory. The event history queue is empty by default.
Use the include parameter to specify whether the channel queue shall be empty after restart (storing of events occurring after the channel is opened), or be filled with all or some events from the event history records.
Use the duration parameter to define the channel duration if it is not accessed via /api/log/pull. The channel will be closed automatically when the defined timeout passes as if the /api/log/unsubscribe function were used.
The function is part of the Logging service and requires some user privileges for authentication. Unprivileged user events shall not be included in the channel queue.
Table of events:
Event type | Required user privileges |
---|---|
TamperSwitchActivated | None |
UnauthorizedDoorOpen | None |
DoorOpenTooLong | None |
LoginBlocked | None |
SilentAlarm | None |
DoorStateChanged | None |
DeviceState | None |
AudioLoopTest | None |
MotionDetected | None |
NoiseDetected | None |
HardwareChanged | None |
FingerEnrollState | None |
LiftStatusChanged | None |
LiftFloorsEnabled | None |
LiftConfigChanged | None |
CapabilitiesChanged | None |
ConfigurationChanged | None |
ExtCameraStateChanged | None |
RescueStateChanged | None |
ErrorStateChanged | None |
LiftCheckingCall | None |
DtmfSent | None |
RexActivated | None |
AccessBlocked | None |
AccessTaken | None |
AccessLimited | None |
DisplayTouched | None |
DtmfPressed | None |
SwitchesBlocked | None |
InputChanged | I/O monitoring |
OutputChanged | I/O monitoring |
VirtualInputChanged | I/O monitoring |
VirtualOutputChanged | I/O monitoring |
SwitchStateChanged | I/O monitoring |
SwitchOperationChanged | I/O monitoring |
UserActionActivated | I/O monitoring |
CardEntered | UID monitoring (cards/Wiegand) |
CardHeld | UID monitoring (cards/Wiegand) |
DtmfEntered | UID monitoring (cards/Wiegand) |
PairingStateChanged | UID monitoring (cards/Wiegand) |
MobKeyEntered | UID monitoring (cards/Wiegand) |
WaveKeyEntered | UID monitoring (cards/Wiegand) |
FingerEntered | UID monitoring (cards/Wiegand) |
UserAuthenticated | UID monitoring (cards/Wiegand) |
UserRejected | UID monitoring (cards/Wiegand) |
CallStateChanged | Call/phone monitoring |
CallSessionStateChanged | Call/phone monitoring |
RegistrationStateChanged | Call/phone monitoring |
DirectoryChanged | System monitoring |
DirectorySaved | System monitoring |
ApiAccessRequested | Access Control Monitoring |
LicensePlateRecognized | Access Control Monitoring |
KeyPressed | Keypad monitoring |
KeyReleased | Keypad monitoring |
CodeEntered | Keypad monitoring |
The GET or POST method can be used for this function.
Request parameters:
Parameter | Type | Mandatory | Default value | Description |
---|---|---|---|---|
include | string | No | new | Define the events to be added to the channel event queue: new – only new events occurring after channel creation all – all events recorded so far including those occurring after channel creation −t – all events recorded in the last t seconds including those occurring after channel creation (−10, e.g.) |
filter | list | No | no filter | List of required event types separated with commas. The parameter is optional and, if not included, all the event types of the device are transmitted via the channel that are not hidden by default. It is necessary to request the hidden events in this parameter to get them. Events hidden by default:
|
duration | uint32 | No | 90 | Define a timeout in seconds after which the channel shall be closed automatically if no /api/log/pull reading operations are in progress. Every channel reading automatically extends the channel duration by the value included here. The maximum value is 3600 s. |
The reply is in the application/json format and includes an identifier created by subscription.
Parameter | Type | Description |
---|---|---|
id | uint32 | Unique identifier created by subscription |
Example:
GET /api/log/subscribe?filter=KeyPressed,InputChanged { "success" : true, "result" : { "id" : 2121013117 } }