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 typeRequired user privileges
TamperSwitchActivatedNone
UnauthorizedDoorOpenNone
DoorOpenTooLongNone
LoginBlockedNone
SilentAlarmNone
DoorStateChangedNone
DeviceStateNone
AudioLoopTestNone
MotionDetectedNone
NoiseDetectedNone
HardwareChangedNone
FingerEnrollStateNone
LiftStatusChangedNone
LiftFloorsEnabledNone
LiftConfigChangedNone
CapabilitiesChangedNone
ConfigurationChangedNone
ExtCameraStateChangedNone
RescueStateChangedNone
ErrorStateChangedNone
LiftCheckingCallNone
DtmfSentNone
RexActivatedNone
AccessBlockedNone
AccessTakenNone
AccessLimitedNone
DisplayTouchedNone
DtmfPressedNone
SwitchesBlockedNone
InputChangedI/O monitoring
OutputChangedI/O monitoring
VirtualInputChangedI/O monitoring
VirtualOutputChangedI/O monitoring
SwitchStateChangedI/O monitoring
SwitchOperationChangedI/O monitoring
UserActionActivatedI/O monitoring
CardEnteredUID monitoring (cards/Wiegand)
CardHeldUID monitoring (cards/Wiegand)
DtmfEnteredUID monitoring (cards/Wiegand)
PairingStateChangedUID monitoring (cards/Wiegand)
MobKeyEnteredUID monitoring (cards/Wiegand)
WaveKeyEnteredUID monitoring (cards/Wiegand)
FingerEnteredUID monitoring (cards/Wiegand)

UserAuthenticated


UID monitoring (cards/Wiegand)
UserRejectedUID monitoring (cards/Wiegand)
CallStateChangedCall/phone monitoring
CallSessionStateChangedCall/phone monitoring
RegistrationStateChangedCall/phone monitoring
DirectoryChangedSystem monitoring
DirectorySavedSystem monitoring

ApiAccessRequested

Access Control Monitoring

LicensePlateRecognized

Access Control Monitoring
KeyPressedKeypad monitoring
KeyReleasedKeypad monitoring
CodeEnteredKeypad monitoring

The GET or POST method can be used for this function.

Request parameters:

Parameter

TypeMandatory

Default value

Description

include

stringNonew

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.)

filterlistNono filterList 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:

  • FingerEnrollState
  • DirectorySaved
  • DirectoryChanged
  • HardwareChanged
  • DisplayTouched
  • PairingStateChanged
  • LiftConfigChanged
  • CapabilitiesChanged
  • ConfigurationChanged
  • ExtCameraStateChanged
durationuint32No90Define 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
  }
}