Note: This function requires an API license.
This command returns a list of specific events for specific cameras. The parameter startid is required to return a list of events. If omitted, or startid is zero or negative, an empty list will be returned with the lastEventId value. The lastEventId value can be used to query for new events.
All other arguments are optional and can be used to filter the kind of event. Filters are and-ed together, meaning the event must match all filters. The argument types is a comma separated list of types (strings) the event must match All events that match one of the types supplied are returned (after ending together with the other filters). If this parameter is omitted, all event types are returned.
The results are always sorted in ascending time. Because of the internal working of the system, it could happen that the order of eventid’s differs from the order of eventtime’s. For example, the result list, ordered by eventtime, could have an eventid sequence of 1, 2, 3, 5, 4, 6.
The result will also give the last event id back. To get only the last event id, issue this command with a zero or negative start id.
Every event in the eventlist has several result fields. Refer to the Event result fields table for a list of all result fields. The value of all event result fields depends on the software version and setup.
The list can be limited by supplying starttime, endtime and/or limit. Refer to chapter
Result list. for an explanation of these parameters.
The parameters deviceid and serverid can be used to get events from a specific device (from a specific server).
Request
command=getEvents&startid=[id]&starttime=[timestamp]&endtime=[timestamp]&types=[string]&limit=[number]&deviceid=[uid]&serverid=[uid] |
parameter | type | remarks |
---|---|---|
startid | [id] | events with an id > startid are returned. |
starttime | [timestamp] | events with a (local) timestamp >= startdate are returned. |
endtime | [timestamp] | events with a (local) timestamp <= enddate are returned. |
types | [string] | comma separated list of types the event must match, i.e. Alarm,SceneR. |
limit | [number] | determines the limit of the resulting event count. |
deviceid | [UID] | filters events from a specific device. |
serverid | [UID] | filters events from a specific server. |
ValueContains | [string] | Only returns events if the value of the event contains the text in this parameter |
ValueEquals | [string] | Only returns events if the value of the event equals the text in this parameters |
CarRLicensePlateFound only | ||
parameter | type | remarks |
licenseplate | [string] | events with the specified license plate are returned (Case sensitive) |
licenseplatedistance | [number] | the number of characters that should match with the entered licenseplate. ( 0 = all chars should match; 1 = one char can differ, 2 = two chars can differ etc.) |
#91;/table#93; | ||
Response | ||
lt;result errorcode=quot;0"> | ||
lt;events count=quot;[number]" lasteventid="[UID]"> | ||
lt;eventgt; | ||
lt;eventidgt;</eventid> | ||
lt;eventtypegt;</eventtype> | ||
lt;eventdescriptiongt;</eventdescription> | ||
lt;eventvaluegt;</eventvalue> | ||
lt;eventtimegt;</eventtime> | ||
lt;serveridgt;</serverid> | ||
lt;serverdescriptiongt;</serverdescription> | ||
lt;deviceidgt;</deviceid> | ||
lt;devicedescriptiongt;</devicedescription> | ||
lt;/eventgt; | ||
... | ||
lt;/eventsgt; | ||
lt;/resultgt; | ||
[table class="code-table table table-bordered" colwidth="15% | 25% | 60%"] |
node | value | remarks |
/result | ||
@errorcode | [number] | See error codes below |
/result/events | ||
@count | [number] | The number of events. |
lastEventId | [UID] | id of the last event. |
/result/events/event | ||
eventid |
| id of event. |
eventype |
| type of event. (Available in API version < 2.7.1) |
eventdescription | description of event. | |
eventvalue | value of event. | |
eventtime |
| Time stamp of event in UTC time. |
serverid |
| Id of server where the event occurred. |
serverdescription |
| Description of the server |
deviceid |
| Id of device which triggered the event. |
devicedescription | Description of the device | |
#91;/table#93; | ||
#91;table class="code-table table table-bordered" colwidth="15% | 25% | 60%"#93; |
error code | description | remarks |
0 | Ok | Ok, no error |
-2 | No device | No device found for the supplied camareaid/deviceid |
-4 | Invalid timestamp | Invalid datetime format. See Timestamp. |
Example
Retrieve the last evenid..
To get the latest event id ommit the startid or give it a zero or negative value.
Command url:
command=getEvents&startid=0 |
Result:
<result errorcode="0"> <events count="0" lasteventid="39993299"> </events> </result> |