Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
https://[IP address or hostname]:[port]/video/

WILL BE DEPRECATED IN NEXT RELEASE, USE /channels

Returns stored video from the camera with the given camera number and options (start time, end time, length, framerate, and/or resolution). Note: Datetime values are formatted according to the ISO 8601 specification: YYYY-MM-DDTHH:MM:SS For example, 2012-12-05T13:40:27. For more information, see this article from the W3C W3.org: Date and Time Formats.

...

Query

URL

Description

ALL EVENTS

https://[IP address or hostname]:8080/feed/events/all

Returns the most recent events of any type.

MOTION EVENTS

https://[IP address or hostname]:8080/feed/events/motion

Returns the most recent motion events.

FACE EVENTS

https://[IP address or hostname]:8080/feed/events/face

For VIP Appliances with the Facial Surveillance analytic enabled, returns the recent faces captured by the system.

GENERIC EVENTS

https://[IP address or hostname]:8080/feed/events/generic

Returns event types that are not system defaults. This includes:

  • Events created by applications using the External System Activity API

  • Events created by a transaction plug-in, such as the 3VR ATM Data Capture plug-in

  • Events generated by an analytic plug-in, such as VIP License Plate Recognition

ALERTS

https://[IP address or hostname]:8080/feed/alerts

Returns the most recent events that have triggered an alert.

SPECIFIC ALERT

https://[IP address or hostname]:8080/feed/alert/[alertname]

Returns the most recent events that triggered the alert named [alertname].

To return more than one alert name, separate the names with an ampersand (&).

Defining Predicates

Predicates act as the filters that determine which events in the system are returned by a specific request. Predicates act on facets of the events. A facet is a single element, such as the start time of the event or the name of a specific alert that the event triggered. These can be combined to form more complex predicates, for example we may want to retrieve all events with a start time that was in the past hour and that triggered the alert called "Motion in Storage Room."

The XML for a predicate has a simple structure. The XML frame for the predicate looks like this:

Code Block
languagexml
<?xml version="1.0" encoding="utf-8"?>
<Predicate>Submitted predicate
</Predicate>

For a complete XML schema of the predicate structure, see the query.xsd file in the SDK.

Each query is a request like this submitted with an HTTP POST command. The Predicate element always has exactly one child, which is the actual predicate. Predicates can be nested when appropriate. For example, an and predicate can contain other predicates but a predicate of type comparison cannot.

An individual predicate has the following form:

Code Block
languagexml
<PredType name="name" isEnabled="True" id="" DistinctIndividualQueries="False">
Sub-predicates or components
</PredType>

For example, the predicate described above (looking for events matching both a time and an alert trigger) will be formatted like this:

Code Block
languagexml
<AndPredicate name="and" isEnabled="True" id="" DistinctIndividualQueries="False">
<ComparisonPredicate name="&gt;" isEnabled="True" id="" DistinctIndividualQueries="False
">
Comparison operands
</ComparisonPredicate>
<ComparisonPredicate name="=" isEnabled="True" id="" DistinctIndividualQueries="False">
Comparison Operands
</ComparisonPredicate>
</AndPredicate

The most important predicates are the Comparison predicate, which supports filtering by facets, and the and and or predicates which allow you to combine predicates in the obvious ways. In the above example we combine two comparison predicates with an and predicate which is quite common.

Please note that although this section of the documentation explains how to manually format a query, 3VR also provides various libraries to construct XML queries with ease. The use of the libraries will be explained later.

Operands

The Comparison predicate compares two Operands using the supplied comparison. The full expression looks like this:

Code Block
languagexml
<ComparisonPredicate name="=" isEnabled="True" id="" DistinctIndividualQueries="False">
<FacetOperand reference="TriggeredAlerts.Alert.Name" />
<Comparison operation="=" />
<ValueOperand type="System.String" value="Motion in Storage Room" />
</ComparisonPredicate>

Here, the comparison is an equals (=) operation, and the operands are a facet operand and a value operand. The facet operand determines which facet of the event to use in the comparison, in this case, TriggeredAlerts.Alert.Name. Please refer to the section "Predicate Facets Reference" for a description of all available facets.

The value operand represents the value and type of operand with which that facet should be compared. The type defines how the value string will be interpreted; the most common types are System.String, System.Integer, System.Long, System.DateTime, and System.TimeSpan. Unless the value should be parsed as a date, the type selected does not usually matter.

The comparison predicate supports the following comparison operations: =, !=, >, >=, <, <= and LIKE. These work as you would expect with LIKE being a standard SQL LIKE. For strings, using LIKE is the same as using = except '_' matches any character and '%' matches any string of characters. Using LIKE with a value operand of 'Smit%' will match any string that begins with 'Smit'
including Smith and Smits.

In addition to the facet operand and the value operand, the system also supports array value operands and relative value operands. Array value operands allow a set of values to be supplied to the comparison. This is only valid when = is used as the comparison operator. The comparison will succeed if any of the values passed in for the array value operand equal the corresponding facet.

The format of the array value operand looks like this:

Code Block
languagexml
<ArrayValueOperand>
<type1 type=" type1" value="value1" />
<type2 type="type2" value="value2" />
… more sub-operands …
</ArrayValueOperand>

For example, if we wanted to extend the above comparison to include events that triggered either a "Motion in Storage Room" alert or a "Motion in Lobby" alert, we can create the following comparison:

Code Block
languagexml
<ComparisonPredicate name="=" isEnabled="True" id="" DistinctIndividualQueries="False">
<FacetOperand reference="TriggeredAlerts.Alert.Name" />
<Comparison operation="=" />
<ArrayValueOperand>
<System.String type="System.String" value="Motion in Storage Room" />
<System.String type="System.String" value="Motion in Lobby" />
</ArrayValueOperand>
</ComparisonPredicate>

Relative value operands allow you to specify operands that are relative to the present. They only work with times. The format for a relative value operand is:

Code Block
<RelativeValueOperand type="System.TimeSpan" value="hh:mm:ss" />

where hh, mm, and ss are hours, minutes and seconds, respectively. For example, to retrieve all events in the past half hour, use the following comparison:

Code Block
languagexml
<ComparisonPredicate name="=" isEnabled="True" id="" DistinctIndividualQueries="False">
<FacetOperand reference="StartTime" />
<Comparison operation="=" />
<RelativeValueOperand type="System.TimeSpan" value="0:30:00" />
</ComparisonPredicate>

To find all events that occurred between 11PM and 1AM, use the following predicate:

Code Block
languagexml
<TimeRangePredicate name="TimeRange" isEnabled="True" id="" DistinctIndividualQueries="Fals
e">
<FacetOperand reference="starttime" />
<ValueOperand type="System.DateTime" value="1/1/2000 11:00 PM" />
<ValueOperand type="System.DateTime" value="1/1/2000 1:00 AM" />
</TimeRangePredicate>