API Specification
Installation
Silent install of Line can be implemented through the key“/S”(from version 7.0.5). The additional keys of Silent Mode Installation(from version 7.1.0):
/NO_KERNEL=YES ; do not install or run kernel service; ;/NO_DRIVERS=YES ; do not install drivers for video capture cards.
After version 6.6.2, Line lets you run the Observer module (including archive playback) with specific command line options.
Video stream and single frames may be acquired through Line's webserver. This option provides the ability to integrate with third party software.
Working with observer.exe from command line
Common format
observer.exe [options] [modes] modes: --simple ; open in simplified view -a, --archive ; open in archive view -m, --allow-multiple-instances ; allow execution many instances of observer --safe-mode ; starting observer in the mode with forced display of the second stream options: -s, --server default: localhost -g, --connect-to-group no default value -p, --port default: 9780 -l, --login default: guard --pwd default: "" -c, --cam-index default: 0 ; available only in --simple mode --cam-stream default: -1 ; available only in --simple mode --pos, --window-pos coordinates format: X1 Y1 X2 Y2 ;default - last time coordinates before closing window --tray ; start program hidden in tray -t, --time date format: YYYY-MM-DD ; default - current date time format: hh:mm:ss ; default - current time -h, --help ; display help message
Comments
You can run Observer with command line options with certain arguments.
This options consist of:
- Mode-change options
- Initialization options
Options
Modes
- --simple - Simplified view mode.
Opens application for one particular cam, e.g., from third-party software. - -a, --archive - Opens application in Archive Playback mode. If aplication's state is Observer mode, then state will be changed to playback with connection to same server.
- -m, --allow-multiple-instances - Execution another copy of observer.
- --safe-mode – starting observer with output of the second stream.
Allows to force switch pictures from the common grid cameras to the second stream
Init
- -s, --server [localhost]
If empty, then will be initiated connect to 127.0.0.1 - -g, --connect-to-group
Parameters allow specifying a group to be connected; group identifier is in the "grp_id" line of the configuration file C:\ProgramData\DevLine\Linia\groups.cfg or C:\Documents and Settings\All Users\Application Data\DevLine\Linia\groups.cfg
Examples:
--connect-to-group 1cff07ad-dc71-498d-87e1-1ef69206d370
-g 1cff07ad-dc71-498d-87e1-1ef69206d370
When connecting to the Line Cloud account:
--connect-to-group sample@google.com
-g sample@google.com - -p, --port [9780]
Connection port. If empty, then connection will be done with standart port, 9780 - -l, --login [guard]
Default user - guard (usually, most limited user) - --pwd [""]
User's password. Default - empty. - -c, --cam-index [0]
Available only in --simple mode. While connecting within --simple mode Observer use local "view" (that is only one, selected cam).
By default, cam ID equal 0. - --cam-stream [-1]
Available only in --simple mode. While connecting within --simple mode Observer use local "view" (that is only one, selected cam).
By default, equal -1. - --window-pos <coordinates>
Postion and size of windows at start.
coordinates: X1 Y1 X2 Y2 - absolute window's coordinates.
where (X1, Y1) - coordinates for top-left corner, and (X2, Y2) - coordinates for bottom-right corner.
By default application will be opened at same place, where it was closed last time. - --tray
Start program hidden in tray - -t, --time <date> <time>
date format: YYYY-MM-DD ; default - current date
time format: hh:mm:ss ; default - current time
This time using as start point for archive playback.
If you set this option while -p (port) equal observer work port (kernel.exe), but not playback work port (oopnet.exe), it will be ignored.
WEB-Server specification
- WEB-Server specification
- Data format
- Authentication
- Resources
- Cameras
- Image
- PTZ
- Cameras's PTZ-control
- Camera's focus control
- Work with Camera's On-Screen Menu
- All Camera's PTZ-presets
- Single Camera's PTZ-preset
- PTZ-preset's image preview
- Microphones
- Audio
- APNR
- OSD (on-screen display)
- Creating OSD-object
- Removing OSD-object
- Adding content to OSD-object
- Removing content from OSD-object
- Archive Event (Since version 6.9.4)
- RPC (Remote Procedure Call) (Since version 8)
- Data formats
- Request structure
- Response structure
- Batch requests
- RPC API Version
- Server information
- Users
- User Attributes
- Group Attributes
- Operation Rights
- Examples of User and Group Settings
- users.get_users
- users.get_user
- users.add_user
- users.remove_user
- users.modify_user
- users.get_groups
- users.get_group
- users.add_group
- users.remove_group
- users.modify_group
- users.get_user_views
- users.set_user_views
- users.get_group_views
- users.set_group_views
- Server Configuration
- Archive
- Archive Timeline
- archive.get_frames_timeline
- archive.get_motions_timeline
- archive.get_channels_list
- archive.get_streams_list
- archive.get_frames_list
- archive.get_frame
- archive.seek_frame
- archive.seek_frames
- Custom Event Log
- Monitoring of Server State
- Other
- Change history
Data format
Supporting JSON or XML (UNIX format line break only) object representations (MIME-types application/json
and application/xml
). The representation will be chosen based on the analysis of the client's request Accept header. If it is not possible to determine the desired representation from the Accept header, objects will be sent using the default view (XML).
Authentication
Proceed by HTTP Digest Authentication. Username and password must be in UTF-8 encoding.
Resources
Every resource may be described by next field sets:
URI: absolute path to resource on server.
Version: interface version, where this resource is available.
MIME-types: data type, which this resource may be represented.
Methods: methods that may be applied to this resource.
Common resource's description, access methods to it, requests parameters, data formats etc.
Cameras
All cameras
URI: /cameras
Version: 1.2
MIME-types: application/json
, application/xml
Methods: GET
List all cameras available at server. JSON representation — objects array camera
. XML representation:
<camera-list> <camera/> <!-- opt --> </camera-list>
Single cam in JSON representation:
{ "uri": /* string */, "name": /* string */, "width": /* number (current resolution) */, "height": /* number (current resolution) */, "image-uri": /* string */, "video-uri": /* string */, "osd-uri": /* string */, "ptz": { "pan-tilt": { "absolute-uri": /* string */, "relative-uri": /* string */ }, "zoom": { "absolute-uri": /* string */, "relative-uri": /* string */ }, "focus": { "absolute-uri": /* string */, "relative-uri": /* string */ }, "menu": { "show-uri": /* string */, "hide-uri": /* string */, "activate-uri": /* string */, "move-uri": /* string */ }, "presets-uri": /* string */ } }
Single cam in XML representation:
<camera> <uri> <!-- xs:anyURI --> </uri> <name> <!-- xs:string --> </name> <width> <!-- xs:nonNegativeInteger --> </width> <height> <!-- xs:nonNegativeInteger --> </height> <image-uri> <!-- xs:anyURI --> </image-uri> <video-uri> <!-- xs:anyURI --> </video-uri> <osd-uri> <!-- xs:anyURI --> </osd-uri> <ptz> <pan-tilt> <absolute-uri> <!-- xs:anyURI --> </absolute-uri> <relative-uri> <!-- xs:anyURI --> </relative-uri> </pan-tilt> <zoom> <absolute-uri> <!-- xs:anyURI --> </absolute-uri> <relative-uri> <!-- xs:anyURI --> </relative-uri> </zoom> <focus> <absolute-uri> <!-- xs:anyURI --> </absolute-uri> <relative-uri> <!-- xs:anyURI --> </relative-uri> </focus> <menu> <activate-uri> <!-- xs:anyURI --> </activate-uri> <show-uri> <!-- xs:anyURI --> </show-uri> <hide-uri> <!-- xs:anyURI --> </hide-uri> <move-uri> <!-- xs:anyURI --> </move-uri> </menu> <presets-uri> <!-- xs:anyURI --> </presets-uri> </ptz> </camera>
Example for resource's interaction:
GET /cameras HTTP/1.1 Host: 127.0.0.1 Accept: application/json
HTTP/1.1 200 OK Date: Mon, 23 May 2005 21:07:53 GMT Content-Type: application/json [ { "uri": "http://127.0.0.1/3r5ggsbJHke", "name": "Newton", "width": 640, "height": 480, "image-uri": "http://127.0.0.1/Ogei7uquahbohyae", "video-uri": "http://127.0.0.1/pamua8Eif4moh6ae" }, "osd-uri": "http://127.0.0.1/knnfHg6" }, { "uri": "http://127.0.0.1/7GheuI95dfghk", "name": "Newton PTZ", "width": 1280, "height": 800, "image-uri": "http://127.0.0.1/PeevupeeNgeir7eu", "video-uri": "http://127.0.0.1/EK8Shadi3fa3noe1", "osd-uri": "http://127.0.0.1/Ldh485h" }, "ptz": { "focus": { "relative-uri": "http://127.0.0.1/ahgae6Shah1oothi" }, "menu": { "activate-uri": "http://127.0.0.1/quee0tieMe1weiRa", "show-uri": "http://127.0.0.1/uGai8doosho7Ohfi", "hide-uri": "http://127.0.0.1/Fohbureit0eedoo0", "move-uri": "http://127.0.0.1/EiY3aach4Nuutha8" }, "pan-tilt": { "relative-uri": "http://127.0.0.1/isai7chahCuChait" }, "zoom": { "relative-uri": "http://127.0.0.1/quieJae7zeish3oo" }, "presets-uri": "http://127.0.0.1/neeloe2po1Hua3xa" } }, { "uri": "http://127.0.0.1/hdUneK3oe8", "name": "camera1", "width": 320, "height": 240, "image-uri": "http://127.0.0.1/ethieSho5ching4e", "video-uri": "http://127.0.0.1/cee9rahtoo4uRooh" }, "osd-uri": "http://127.0.0.1/Jy8Uj8" }, { "uri": "http://127.0.0.1/Heo89qli3J", "name": "hallway", "width": 320, "height": 240, "image-uri": "http://127.0.0.1/xohpai8jeQuohm6f", "video-uri": "http://127.0.0.1/euDaiheejiaGae3s" } "osd-uri": "http://127.0.0.1/Oje654fgbd" } ]
Image
Single frame
URI: <image-uri of camera's object>
Version: 1.0
MIME-type: image/jpeg
, image/png
Methods: GET
Request parameters:
- quality — image quality. Set by integer from 0 (maximum compression) to 100 (maximum quality). If is not set, then using default value for this cam.
- resolution — image resolution. If is not set, then using current resolution for this cam.
- keep_aspect_ratio — keep aspect ratio: 0 - no, 1 - yes. Default 0(no).
Resource interaction example:
GET /ethieSho5ching4e?keep_aspect_ratio=1&resolution=640x480 HTTP/1.1 Host: 127.0.0.1 Accept: image/*
HTTP/1.1 200 OK Date: Mon, 23 May 2005 23:15:27 GMT Content-Type: image/jpeg Content-Length: 23185 [Image data]
M-JPEG stream
URI: <video-uri of camera's object>
Version: 1.0
MIME-types: multipart/x-mixed-replace
, image/jpeg
Methods: GET
Request parameters:
- fps — maximum frames per second. If is not set, then using current value for cam.
- quality — image quality. Set by integer from 0 (maximum compression) to 100 (maximum quality). If is not set, then using default value for this cam.
- resolution — image resolution. If is not set, then using current resolution for this cam.
- keep_aspect_ratio — keep aspect ratio: 0 - no, 1 - yes. Default 0(no).
Resource interaction example:
GET /cee9rahtoo4uRooh?keep_aspect_ratio=0&fps=5&resolution=320x240 HTTP/1.1 Host: 127.0.0.1
HTTP/1.1 200 OK Date: Mon, 23 May 2005 23:15:27 GMT Content-Type: multipart/x-mixed-replace; boundary=xyzzy --xyzzy Content-Type: image/jpeg Content-Length: 15382 [Frame 1 data] --xyzzy Content-Type: image/jpeg Content-Length: 16105 [Frame 2 data] [etc.]
FLV stream
Protocol: HTTPPort: 9786 (default)
URI:
<streaming-uri of Camera>
Methods: GET
Limitations: Versions 7.7.0 and lower
To create a link to the stream, use the value <streaming-uri of Camera> and the stream identifier made up of the name and extension. The stream identifier can take two values:
- sub.flv - secondary stream (low resolution);
- main.flv - primary stream (high resolution).
Examples of links to streams:
http://login:@192.168.0.123:9786/cameras/0/streaming/main.flv http://login:password@192.168.0.123:9786/cameras/15/streaming/sub.flvOn clients where it is not possible to authorize a request using standard means (HTTP Digest/Basic Authentication), it is possible to transfer the Authorization header with one of the request parameters, for example
http://192.168.0.123:9786/cameras/2/streaming/main.flv?authorization=Basic%20d2ViOg==
HLS stream
Protocol: HTTPPort: 9786 (default)
URI: URI:
<streaming-uri of Camera>
Methods: GET
Limitations:Versions 7.7.0 and higher
To create a link to the stream, use the value <streaming-uri of Camera> and the stream identifier made up of the name and extension. The stream identifier can take two values:
- sub.m3u8 - secondary stream (low resolution);
- main.m3u8 - primary stream (high resolution).
- audio — audio-stream (0 – without audio, 1 – with audio). Default setting - 0 (no).
Examples of stream links:
http://login:@192.168.0.123:9786/cameras/0/streaming/main.m3u8?audio=1 http://login:password@192.168.0.123:9786/cameras/15/streaming/sub.m3u8On clients where it is not possible to authorize a request using standard means (HTTP Digest/Basic Authentication), it is possible to transfer the Authorization header with one of the request parameters, for example
http://192.168.0.123:9786/cameras/2/streaming/main.m3u8?authorization=Basic%20d2ViOg==
MP4 stream
Protocol: HTTPPort: 9786 (default)
URI:
<streaming-uri of Camera>
Methods: GET
Limitations: Versions 8.0 and higher
To create a link to the stream, use the value <streaming-uri of Camera> and the stream identifier made up of the name and extension. The stream identifier can take two values:
- sub.mp4 - secondary stream (low resolution);
- main.mp4 - primary stream (high resolution).
- time — the moment in time in ISO 8601 format, from which the archive will be exported.
- duration — duration in seconds (format HH:MM:SS). Optional parameter.
- download — allow file to be downloaded. 0 – no, 1 – yes. Default setting – 0 (no).
- audio — audio stream (0 – without audio, 1 – with audio). Default setting – 0 (no).
- filename — name of file.
Examples of stream links:
http://login:password@192.168.0.123:9786/cameras/6/streaming/main.mp4? time=2021-05-12T13:00:00&duration=00:40:00&audio=1On clients where it is not possible to authorize a request using standard means (HTTP Digest/Basic Authentication), it is possible to transfer the Authorization header with one of the request parameters, for example
http://192.168.0.123::9786/cameras/6/streaming/main.mp4?time=2021-05-12T13:00:00& duration=00:40:00&audio=1&authorization=Basic%20d2ViOg==
RTSP stream
Protocol: RTSPPort: 9784 (default)
URI:
/cameras/<index>/streaming/<name>
Methods: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE
Limitations: Not implemented in the Windows version
To generate a link for the stream, use the camera's serial number (<index>) and stream name (<name>), which can have two values:
- sub - second stream (low resolution);
- main - first stream (high resolution).
Examples of stream links:
rtsp://login:@192.168.0.123:9784/cameras/0/streaming/main?audio=1 rtsp://login:password@192.168.0.123:9784/cameras/15/streaming/subOn clients where it is not possible to authorize a request using standard means (HTTP Digest/Basic Authentication), it is possible to transfer the Authorization header with one of the request parameters, for example
rtsp://192.168.0.123:9784/cameras/2/streaming/main?authorization=Basic%20d2ViOg==
PTZ
Camera's PTZ-control
URI: <absolute-uri or relative-uri of camera's object/ptz/pan-tilt and /ptz/zoom>
Version: 1.0
MIME-types: application/json
, application/xml
Methods: PUT
PTZ-control prduced by record with specified objects URIs pan-tilt-data
and zoom-data
.
JSON-representation pan-tilt-data
{ "x": /* number */, "y": /* number */, "speed": /* number */ }
XML-representation:
<pan-tilt-data> <x> <!-- xs:float --> </x> <y> <!-- xs:float --> </y> <speed> <!-- xs:float --> </speed> </pan-tilt-data>
JSON-representation zoom-data:
{ "zoom": /* number */, "speed": /* number */ }
XML-representation:
<zoom-data> <zoom> <!-- xs:float --> </zoom> <speed> <!-- xs:float --> </speed> </zoom-data>
Valid values of speed
parameter are in interval [0, 1]. Parameters x
, y
and zoom
for commands of relative rotation set in abstract units - it is only -1 and +1 now.
Example — relative rotation from current position:
PUT /isai7chahCuChait HTTP/1.1 Host: 127.0.0.1 Content-Type: application/xml <?xml version="1.0" encoding="UTF-8"?> <pan-tilt-data> <x>-1.0</x> <y>0.0</y> <speed>1.0</speed> </pan-tilt-data>
HTTP/1.1 204 No Content Date: Tue, 24 May 2005 17:21:15 GMT
Example — relative scaling:
PUT /quieJae7zeish3oo HTTP/1.1 Host: 127.0.0.1 Content-Type: application/xml <?xml version="1.0" encoding="UTF-8"?> <zoom-data> <zoom>1.0</zoom> <speed>1.0</speed> </zoom-data>
HTTP/1.1 204 No Content Date: Tue, 24 May 2005 17:21:37 GMT
Camera's focus control
URI: <absolute-uri or relative-uri of camera's object/ptz/focus>
Version: 1.0
MIME-types: application/json
, application/xml
Methods: PUT
JSON-representation of focus data:
{ "focus": /* number */, "speed": /* number */ }
XML-representation:
<focus-data> <focus> <!-- xs:float --> </focus> <speed> <!-- xs:float --> </speed> </focus-data>
Valid values of speed
parameter are in interval [0, 1]. Parameter focus
for commands of relative focus changing set in abstract units - it is only -1 and +1 now.
Example for resource's interaction:
PUT /ahgae6Shah1oothi HTTP/1.1 Host: 127.0.0.1 Content-Type: application/json { "focus": -1.0, "speed": 1.0 }
HTTP/1.1 204 No Content Date: Tue, 24 May 2005 17:38:27 GMT
Work with Camera's On-Screen Menu
URI: <activate-uri, show-uri, hide-uri and move-uri of camera's object/ptz/menu>
Version: 1.0
MIME-types: application/json
, application/xml
Methods: PUT
Resources self-provide commands executed by method PUT. Into resources with activate-uri
(choice menu item), show-uri
(show menu) hide-uri
(hide menu) allowed record without request body.
Menu moving proceed by recording menu's command into resource with move-uri
.
JSON-representation menu's command:
{ "action": /* string */ }
XML-representation:
<menu-command action="xs:string"/>
Where action valid in one of: left
, right
, up
or down
.
Example for menu's interaction — show menu:
PUT /uGai8doosho7Ohfi HTTP/1.1 Host: 127.0.0.1
HTTP/1.1 204 No Content Date: Tue, 24 May 2005 13:28:15 GMT
Moving bottom to the next menu item:
PUT /EiY3aach4Nuutha8 HTTP/1.1 Host: 127.0.0.1 Content-Type: application/json { "action": "down" }
HTTP/1.1 204 No Content Date: Tue, 24 May 2005 13:28:19 GMT
Choice menu item:
PUT /quee0tieMe1weiRa HTTP/1.1 Host: 127.0.0.1
HTTP/1.1 204 No Content Date: Tue, 24 May 2005 13:28:22 GMT
Hide menu:
PUT /Fohbureit0eedoo0 HTTP/1.1 Host: 127.0.0.1
HTTP/1.1 204 No Content Date: Tue, 24 May 2005 13:28:24 GMT
All Cameras’ PTZ-presets.
URI: <presets-uri camera's object>
Version: 1.0
MIME-types: application/json
, application/xml
Methods: GET, POST
Single Camera's PTZ-preset.
Example for resource's interaction:
GET /neeloe2po1Hua3xa HTTP/1.1 Host: 127.0.0.1 Accept: application/xml
HTTP/1.1 200 OK Date: Tue, 24 May 2005 17:14:16 GMT Content-Type: application/xml <?xml version="1.0" encoding="UTF-8"?> <ptz-preset-list> <ptz-preset> <name>Unu</name> <activate-uri>http://127.0.0.1/OhX7iet9aithoofu</activate-uri> <preset-uri>http://127.0.0.1/doo3ree1aef8Vudo</preset-uri> <preview-uri>http://127.0.0.1/eer7vei9thoa4Eik</preview-uri> <update-uri>http://127.0.0.1/keenoo3IthoP4zai</update-uri> </ptz-preset> <ptz-preset> <name>Du</name> <activate-uri>http://127.0.0.1/xee9uz7Aich4tuga</activate-uri> <preset-uri>http://127.0.0.1/gool9hieR3iu5hoh</preset-uri> <preview-uri>http://127.0.0.1/ingae4ooCh8ahb4a</preview-uri> <update-uri>http://127.0.0.1/ohxuof4Su7ekiuDi</update-uri> </ptz-preset> <ptz-preset> <name>Tri</name> <activate-uri>http://127.0.0.1/Uosuu4aivuuchei4</activate-uri> <preset-uri>http://127.0.0.1/Atejae1baeD6Ku4A</preset-uri> <preview-uri>http://127.0.0.1/Sheip2ooXohd1Phe</preview-uri> <update-uri>http://127.0.0.1/haurieP9chosaif4</update-uri> </ptz-preset> </ptz-preset-list>
POST /neeloe2po1Hua3xa HTTP/1.1 Host: 127.0.0.1 Accept: application/xml Content-Type: application/xml <?xml version="1.0" encoding="utf-8"?> <ptz-preset> <name>Kvar</name> </ptz-preset>
HTTP/1.1 201 Created Date: Tue, 24 May 2005 17:14:23 GMT Content-Type: application/xml <?xml version="1.0" encoding="utf-8"?> <ptz-preset> <name>Kvar</name> <activate-uri>http://127.0.0.1/owaSiewahch3ohch</activate-uri> <preset-uri>http://127.0.0.1/xie4Aoz8aqu0aigh</preset-uri> <preview-uri>http://127.0.0.1/laeMeef4Kariphu6</preview-uri> <update-uri>http://127.0.0.1/ahghohK4iezoovah</update-uri> </ptz-preset>
Single Camera's PTZ-preset
URI: <preset-uri PTZPreset object>
Version: 1.0
MIME-types: application/json
, application/xml
Methods: DELETE, GET, PUT
JSON representation:
{ "name": /* string */, "activate-uri": /* string */, "preview-uri": /* string */, "update-uri": /* string */ }
XML representation:
<ptz-preset> <name> <!-- xs:string --> </name> <activate-uri> <!-- xs:anyURI --> </activate-uri> <preview-uri> <!-- xs:anyURI --> </preview-uri> <update-uri> <!-- xs:anyURI --> </update-uri> </ptz-preset>
Example for resource's interaction:
GET /phiwohGh5aer0ye4 HTTP/1.1 Host: 127.0.0.1 Accept: application/json
HTTP/1.1 200 OK Date: Tue, 24 May 2005 14:39:18 GMT Content-Type: application/json { "name": "Xyzzy!", "activate-uri": "http://127.0.0.1/ju9moT7wuciiW7ae", "preview-uri": "http://127.0.0.1/eite4ohLiQu5Veoc", "update-uri": "http://127.0.0.1/WieB4ahng4ieghi9" }
PUT /phiwohGh5aer0ye4 HTTP/1.1 Host: 127.0.0.1 Accept: application/xml Content-Type: application/json { "name": "Zyxxy?", "activate-uri": "http://127.0.0.1/ju9moT7wuciiW7ae", "preview-uri": "http://127.0.0.1/eite4ohLiQu5Veoc", "update-uri": "http://127.0.0.1/WieB4ahng4ieghi9" }
HTTP/1.1 200 OK Date: Tue, 24 May 2005 14:39:37 GMT Content-Type: application/xml <?xml version="1.0" encoding="utf-8"?> <ptz-preset> <name>Zyxxy?</name> <activate-uri>http://127.0.0.1/ju9moT7wuciiW7ae</activate-uri> <preset-uri>http://127.0.0.1/phiwohGh5aer0ye4</preset-uri> <preview-uri>http://127.0.0.1/eite4ohLiQu5Veoc</preview-uri> <update-uri>http://127.0.0.1/WieB4ahng4ieghi9</update-uri> </ptz-preset>
PTZ-preset's image preview
URI: <preview-uri PTZPreset object>
Version: 1.0
MIME-types: image/jpeg
, image/png
Methods: GET
Size of preview image depends from camera.
Example for resource's interaction:
GET /eite4ohLiQu5Veoc HTTP/1.1 Host: 127.0.0.1 Accept: image/png
HTTP/1.1 200 OK Date: Tue, 24 May 2005 11:27:16 GMT Content-Type: image/png Content-Length: 2108 [Image Data]
Microphones
All microphones
URI: /microphones
Version: 1.2
MIME-types: application/json
, application/xml
Methods: GET
List all microphones available at server.
JSON representation — objects array microphone
.
XML - representation:
<microphone-list> <microphone/> <!-- opt --> </microphone-list>
Single microphone in JSON representation:
{ "uri": /* string */, "name": /* string */, "audio-uri": /* string */, "camera-uri": /* string */ }
Single microphone in XML representation:
<microphone> <uri> <!-- xs:anyURI --> </uri> <name> <!-- xs:string --> </name> <audio-uri> <!-- xs:anyURI --> </audio-uri> <camera-uri> <!-- xs:anyURI --> </camera-uri> </microphone>
Example for resource's interaction:
GET /microphones HTTP/1.1 Host: 127.0.0.1 Accept: application/json
HTTP/1.1 200 OK Date: Mon, 23 May 2005 21:07:53 GMT Content-Type: application/json [ { "uri": "http://127.0.0.1/6Hjk9l4dudlf", "name": "Newton", "audio-uri": "http://127.0.0.1/Ogei7uquahbohyae", "camera-uri": "http://127.0.0.1/pamua8Eif4moh6ae" }, { "uri": "http://127.0.0.1/Pqja954nfrdqcb", "name": "Microphone1", "audio-uri": "http://127.0.0.1/ethieSho5ching4e", "camera-uri": "http://127.0.0.1/cee9rahtoo4uRooh" }, { "uri": "http://127.0.0.1/Q57mak8maogk", "name": "Hallway", "audio-uri": "http://127.0.0.1/xohpai8jeQuohm6f", "camera-uri": "http://127.0.0.1/euDaiheejiaGae3s" } ]
Audio
Audio Stream
URI: <audio-uri Microphone object>
Version: 1.1
MIME-types: audio/x-wav
, audio/mpeg
Methods: GET
Request parameters:
- sample_rate — signal sampling rate. Valid values in [8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000] Hz. If is not set. then using value equal 22050.
- bit_rate — bitrate, e.g. 128. If is not set, using 64 kbps for audio/mpeg and 22050 * 16 bps (22.05 kHz * 16 bit) for audio/x-wav.
Example for resource's interaction:
GET /ethieSho5ching4e?sample_rate=44100&bit_rate=128 HTTP/1.1 Host: 127.0.0.1 Accept: audio/mpeg
HTTP/1.1 200 OK Date: Mon, 23 May 2005 23:15:27 GMT Content-Type: audio/mpeg [Audio data]
Audio broadcasting lasts until disconnect by any side.
APNR
How to receive:
{ "method" : "plate_recognizer.get_lists_config", "version" : @version }
By receiving a response to the plate_recognizer.get_lists_config query:
{ "result" : { "config" : { "lists" : [ ... ] }, "revision" : "1c468c284ec9409fa070c7522a6bc2f710ccc3d5" } }
- revision - only computed by the server, since the notation of settings may be various (msgpack/json/etc.).*
A query to change the settings
How to send:
{ "method" : "plate_recognizer.set_lists_config", "params" : { "config" : { "lists" : [ { "id" : "0", "client_data" : { "name" : "Persons paid for parking", "description" : "Good chaps", }, "entries" : [ { "text" : "A123BC456", "client_data" : { "name" : "Jones", "description" : "Entrance 1, flat 13, tel: +000000000" } }, { "text" : "A321BC654", "client_data" : { "name" : "Smith", "description" : "Entrance 2, flat 24, tel: +000000000" } } ] }, { "id" : "1", "client_data" : { "name" : "Persons haven’t paid for parking", "description" : "Bad chaps", }, "entries" : [ { "text" : "B321CA456", "client_data" : { "name" : "Williams", "description" : "Entrance 3, flat 39, tel: +000000000" } } ] } ] }, "base_revision" : "fa2421b790e473508b60f6c78ce66f3e84a610ca" }, "version" : @version }
- Among all the attributes in the list, only id and entries are important to the server. The rest of the parameters are shown just for demonstration purposes.
- base_revision is an optional parameter. If it is not set, the list will be accepted and saved without any check. If it is set, the server will compare it to the current value of “revision” in the settings, and in case the values coincide, then the list shall be accepted and saved. If they do not coincide, the server will return an error indicating the actual value of “revision” which it expects in such a query:
config { "error" : { "type" : "invalid_param", "message" : "base_revision", "data" : { "revision" : "1c468c284ec9409fa070c7522a6bc2f710ccc3d5" }, } }
OSD (on-screen display)
Creating OSD
URI: <osd-uri Camera's object>
Version: 1.5
MIME-types: application/json
, application/xml
Methods: POST
Request body in JSON representation:
{ "name": /* string */, "left": /* number */, "top": /* number */, "font-size": /* number */, "font-color": /* string */, "line-count": /* number */, "draw-background": /* number */ }
Request body in XML representation:
<osd-zone-data> <name> <!-- xs:string --> </name> <left> <!-- xs:nonNegativeInteger --> </left> <top> <!-- xs:nonNegativeInteger --> </top> <font-size> <!-- xs:nonNegativeInteger --> </font-size> <font-color> <!-- xs:string --> </font-color> <line-count> <!-- xs:nonNegativeInteger --> </line-count> <draw-background> <!-- xs:nonNegativeInteger --> </draw-background> </osd-zone-data>
Output coordinates and font size set in % related to frame sizes.
Parameter <font-color>
set with link like #RGB, where R, G, B - value of color parts at hex-form in interval [0..255].
Parameter
Success server answer on this request:
HTTP/1.1 201 Created Location: <URI OSD>
Example for resource's interaction:
POST <osd-uri object Camera> HTTP/1.1 Host: 127.0.0.1 Content-Type: application/json { "name": "xyz", "left": 10, "top": 20, "font-size": 10, "font-color": "#00FF00", "line-count": 10, "draw-background": 1 }
HTTP/1.1 201 Created Date: Mon, 23 May 2005 23:15:27 GMT Location: <osd-uri object Camera>/xyz
Removing OSD-object
URI: <URI OSD object>
Version: 1.2
Methods: DELETE
Example for resource's interaction:
DELETE <URI OSD-object> HTTP/1.1 Host: 127.0.0.1
HTTP/1.1 204 No content Date: Mon, 23 May 2005 23:15:27 GMT
Adding content to OSD-object
URI: <URI OSD object>
Version: 1.2
MIME-types: text/plain
Methods: POST
Example for resource's interaction:
POST <URI OSD-object> HTTP/1.1 Host: 127.0.0.1 Content-Type: text/plain Content-Length: 15 Hello, world!!!
HTTP/1.1 201 Created Date: Mon, 23 May 2005 23:15:27 GMT
Removing content from OSD-object
URI: <URI OSD object>/clear
Version: 1.2
MIME-types: text/plain
Methods: PUT
Example for resource's interaction:
PUT <URI OSD-object>/clear HTTP/1.1 Host: 127.0.0.1
HTTP/1.1 204 No content Date: Mon, 23 May 2005 23:15:27 GMT
Archive Event
Create Archive Event
URI: /events
MIME-types: application/json, application/xml
Methods: POST
JSON request format:
{ "time" : /*string*/, "source" : /*string*/, "name" : /*string*/, "device": /*number*/, "data" : /*string*/ }
Parameters:
time - Archive Event start time in ISO 8601 format. Optional. Default value is the present time on the server.
source - Archive Event source. Optional. Default value is an empty string.
name - Archive Event name. Optional. Default value is an empty string.
device - Ordinal number of the camera. Optional. Default value is -1 indicating the event is not tied to any camera.
data - Archive Event data. Optional. Default value is an empty string.
Server response:
HTTP/1.1 201 Created Location: <URI Archive Event object>
JSON response example:
POST /events HTTP/1.1 Host: localhost:9786 Content-Type: application/json { "time" : "2005-08-09T18:31:42.201", "source" : "test source", "name" : "test name", "device": 0, "data" : "test data" } HTTP/1.1 201 Created Date: Mon, 23 May 2009 23:15:27 GMT Location: events/gds2w8sd1w
Location header contains the address of the Archive Event object which can be accessed later.
RPC (Remote Procedure Call)
URI: /rpc
MIME types: application/json, application/x-msgpack
Methods: POST
The resource provides easy access to the capabilities of full-blown Line server communication protocol. This protocol is used, for example, by "Observer" application. Developers should not implement the network part of the interaction and can use HTTP as transport protocol.
Data formats
Request can be transmitted using JSON (version 7.1.1 or higher) or MessagePack (version 7.0 or higher) formats. Formats of request and reply are always the same. Text encoding is UTF-8. In order to get maximal performance it is recommended to use MessagePack. All examples are presented in JSON format.
Time
Time is represented as an array of integers. Its elements represent year, month, day, hour, minute, seconds, and milliseconds respectively. If some element in the end of the array equals to zero, it can be omitted. For example, “October 30, 2016, 15:00” could not only be presented as [2016, 11, 30, 15, 0, 0, 0] but also as [2016, 11, 30, 15].
Request structure
In the case of a single request, it is an object with one required field:
- method - a method name.
and optional fields:
- params - an object with the parameters;
- id - an integer ID, which will be included in the response;
Request sample:
1{ 2 "id" : 42, 3 "method" : "some_method", 4 "params" : 5 { 6 "some_param" : "some_value" 7 } 8}
Response structure
Response also is an object, a set of fields that depends on a success of a inquiry processing:
- id - an integer ID that was contained in the request;
- result - an object with the result; It is contained in a response only in case of successful processing command;
- error - an object with information about the error.
Response sample for successful request processing:
POST /rpc HTTP/1.1 Host: 127.0.0.1 Content-Type: application/json { "method" : "sum_two_numbers", "params" : { "first" : 30, "second" : 12 } }
HTTP/1.1 200 OK Date: Tue, 07 Jun 2016 07:52:46 GMT Content-Type: application/json { "result" : { "sum" : 42 } }
Response sample where errors occurred during request processing:
POST /rpc HTTP/1.1 Host: 127.0.0.1 Content-Type: application/json { "method" : "sum_two_numbers", "params" : { "second" : 30 } }
HTTP/1.1 200 OK Date: Tue, 07 Jun 2016 07:52:46 GMT Content-Type: application/json { "error" : { "type" : "invalid_param", "message" : "first" } }
Batch requests
Server supports execution of a list of commands transmitted simultaneously. In this case, the commands should be represented as an array of single requests. Response to such request will be represented as an array of single responses, the order of which will correspond to the order of requests:
POST /rpc HTTP/1.1 Host: 127.0.0.1 Content-Type: application/json [ { "method" : "mul_two_numbers", "params" : { "first" : 7, "second" : 6 } }, { "method" : "sub_two_numbers", "params" : { "first" : 30 } } ]
HTTP/1.1 200 OK Date: Tue, 07 Jun 2016 07:52:46 GMT Content-Type: application/json [ { "result" : { "mul" : 42 } }, { "error" : { "type" : "invalid_param", "message" : "second" } } ]
RPC API Version
Information on the RPC API version contains a text name and integer value that increases every time a change to the API server is made. The version value can be used to determine the required methods and parameters for server support. A method with the same name can be implemented differently in different API versions, for example, it can have different parameters.
get_version
Request Example:
1{ 2 "method" : "get_version" 3}
Response Example:
1{ 2 "result" : { 3 "version" : { 4 "name" : "v20200622", 5 "value" : 13 6 } 7 } 8}
Server information
get_server_info
Minimum API version: 12
Response content:
- id - a unique identifier for the server.
- name - server name.
- network - detaild of the server's network settings, a list of port numbers for connecting to the server using different protocols.
- version - version information.
- local_time - server local time.
Request Example:
1{ 2 "method" : "get_server_info", 3 "version" : 12 4}
Response Example:
1{ 2 "result" : { 3 "info" : { 4 "id" : "bf57f49b771a", 5 "name" : "Devline XVR4", 6 "network" : { 7 "ports" : { 8 "http" : 9786, 9 "main" : 9780, 10 "ping" : 9877, 11 "rtsp" : 9784 12 } 13 }, 14 "version" : { 15 "name" : "v20200901", 16 "value" : 15 17 }, 18 "local_time" : [2020,9,29,16,39,38,226] 19 } 20 } 21}
Users
System user settings are presented as lists of groups and users. Each user can be included in one group or have settings independent of groups. One group cannot be included in another group. The main system user ("admin" by default) cannot inherit settings of groups and have any kind of rights restrictions. The list of permissible changes to settings for the main user is limited to setting the username and password pair and changing the views of the cameras on the screen.
Including a user in a group is done by assigning an identifier of the parent group to the list of user attributes. A user, included in a group, can both inherit each individual configuration attribute of the parent group and override its value. For example, the user can inherit the list of accessible video devices but have a unique list of audio devices. If the user’s attribute value is assigned, then the attribute is considered overridden, if not, then inherited. If the attribute is not defined for either the user or parent group, then the user does not have the restrictions corresponding to that attribute, for example, if the list of devices is not assigned, then all devices are available.
User Attributes
Mandatory:
- id - identifier;
- name - name;
- secret - user secret, calculated as MD5 (username:realm:password), where the value "realm", actual to the server, can be obtained using the "auth" RPC method.
Optional:
- group - parent group identifier;
- description - description;
- enabled - activity, by default: true;
- expiration_time - activity end-time;
- time_ranges - list of weekdays and activity timeframes;
- video_devices - list of available video devices;
- audio_devices - list of available audio devices;
- ptz_devices - list of available PTZ devices;
- server_operations - list of available server operations;
- client_operations - list of available client operations;
- views - if not defined, then the list of views is inherited from the parent group.
Group Attributes
Mandatory:
- id - identifier;
- name — name.
Optional:
- description - description;
- enabled - activity, by default: true;
- expiration_time - activity end-time;
- time_ranges - list of weekdays and activity timeframes;
- video_devices - list of available video devices;
- audio_devices - list of available audio devices;
- ptz_devices - list of available PTZ devices;
- server_operations - list of available server operations;
- client_operations - list of available client operations.
Operation Rights
The list of operation rights is in the form of a dictionary in which operations identifiers are used as the keys, and true or false as the values. The set of all operations available to the user are split into two lists: server and client operations. The server can control only a limited set of operations carried out by the user, for example, changing the configuration and access to the archive, but cannot control, for example, minimizing the client application windows, saving images and using digital zoom. Several operations may be restricted on both the server and client, while further prohibition of operations on the client is necessary only for ease of interaction with the program (absence of interface elements for operations prohibited on the server).
Server operations:
- archive_access - access the archive;
- archive_events_add - add events to the archive;
- archive_events_access - access events in the archive;
- adm_configuration - access to change configuration files;
- adm_users - change user settings;
- adm_video - change video device settings;
- adm_audio - change audio device settings;
- adm_ptz - change PTZ device settings;
- adm_archive - change archive recording settings;
- adm_network - change network settings;
- adm_analytics - change video analytics settings;
- adm_reactions - change response settings;
- adm_licensing - access licensing settings;
- adm_userlog - access user log;
- adm_filesystem - access server file system;
- adm_monitoring - access server state monitoring.
Client operations:
- find_server - search for servers;
- select_views - switch camera view;
- cam_assignment - change location of cameras in the view;
- change_cam_stream - switch camera stream display;
- change_all_cams_stream - simultaneous switching of stream display for all cameras;
- use_zoom - digital image zoom;
- save_cam_frame - save frames;
- setup_cam_color - rapid change of camera image parameters;
- view_archive - view archive;
- view_archive_in_folder - view archive from specified folder;
- export_archive - export archive;
- decompose_frames - breakdown of archive into individual frames;
- view_archive_events - archive event viewing;
- add_archive_events - adding events to the archive;
- enter_in_adm - server administration;
- adm_view_monitoring - server state monitoring;
- adm_view_analytics - access video analytics settings;
- adm_access_to_filesystem - access to server file system;
- adm_setup_licensing - access to licensing settings;
- adm_setup_users - access to user settings;
- adm_setup_video - access to video device settings;
- adm_setup_audio - access to audio device settings;
- adm_setup_ptz - access to PTZ device settings;
- adm_setup_network - access to network settings;
- adm_setup_archive - access to archive recording settings;
- adm_setup_reactions - access to reaction settings;
- adm_view_userlog - access to user log;
- close_program - program termination;
- maximize_window - maximize program window to full screen;
- minimize_window - minimize program windows.
Examples of User and Group Settings
User without rights restrictions:
1{ 2 "id" : "00000000", 3 "name" : "admin", 4 "secret" : "d87fab4d658bc121c37936fb957d2fa5" 5}
Disconnected user with limited device list:
1{ 2 "id" : "00000001", 3 "name" : "user", 4 "secret" : "d87fab4d658bc121c37936fb957d2fa5", 5 "description" : "Some text. Some text.", 6 "enabled" : false, 7 "video_devices" : [ "3", "11" ] 8}
User, active until 2:14 AM, August 29, 1997:
1{ 2 "id" : "00000001", 3 "name" : "user", 4 "secret" : "d87fab4d658bc121c37936fb957d2fa5", 5 "expiration_time" : [1997,8,29,2,14,00] 6}
Group of users with limited operations list and user, included in it, who inherits operations restrictions and has his own restrictions on operating time (Mon-Fri 08:00-19:00 and Sat-Sun 10:00-15:00):
1{ 2 "id" : "00000001", 3 "name" : "Group1", 4 "server_operations" : { "archive_access" : true }, 5 "client_operations" : { "view_archive" : true, "save_cam_frame" : true } 6}
1{ 2 "id" : "00000001", 3 "name" : "User1", 4 "group" : "00000001", 5 "secret" : "d87fab4d658bc121c37936fb957d2fa5", 6 "time_ranges" : [ 7 { 8 "dow" : [0,1,2,3,4], 9 "start_time" : [8,0,0], 10 "end_time" : [19,0,0] 11 }, 12 { 13 "dow" : [5,6], 14 "start_time" : [10,0,0], 15 "end_time" : [15,0,0] 16 } 17 ] 18}
User inheriting all parent group attributes but with his own list of available camera locations on the screen:
1{ 2 "id" : "00000002", 3 "name" : "user", 4 "secret" : "d87fab4d658bc121c37936fb957d2fa5", 5 "views" : {} 6}
users.get_users
Minimum API version: 12
Getting a list of server users.
Request Example:
1{ 2 "method" : "users.get_users", 3 "version" : 12 4}
Response Example:
1{ 2 "result" : { 3 "users" : [ 4 { 5 "id" : "00000000", 6 "name" : "admin", 7 "secret" : "4fe612b4dcf238983ae0ad620ce4961c" 8 }, 9 { 10 "id" : "00000001", 11 "name" : "user", 12 "secret" : "3ae0ad620ce4961c4fe612b4dcf23898", 13 "video_devices" : ["2", "4"] 14 } 15 ] 16 } 17}
users.get_user
Minimum API version: 12
Getting user settings.
Request parameters:
- id - user ID.
Request Example:
1{ 2 "method" : "users.get_user", 3 "params" : { "id" : "00000000" }, 4 "version" : 12 5}
Response Example:
1{ 2 "result" : { 3 "user" : { 4 "id" : "00000000", 5 "name" : "admin", 6 "secret" : "4fe612b4dcf238983ae0ad620ce4961c" 7 } 8 } 9}
users.add_user
Minimum API version: 12
Adding a user.
Request parameters:
- user - set of user attributes without identifier.
Request Example:
1{ 2 "method" : "users.add_user", 3 "params" : { 4 "user" : { 5 "name" : "test", 6 "secret" : "fef6bd724619600ebb1de3936337e942" 7 } 8 }, 9 "version" : 12 10}
Response Example:
1{ 2 "result" : { 3 "user" : { 4 "id" : "00000003" 5 } 6 } 7}
users.remove_user
Minimum API version: 12
Removing a user.
Request parameters:
- id - user ID.
Request Example:
1{ 2 "method" : "users.remove_user", 3 "params" : { "id" : "00000002" }, 4 "version" : 12 5}
Response Example:
1{ 2 "result" : {} 3}
Error Example:
1{ 2 "error" : { 3 "type" : "invalid_param", 4 "message" : "id" 5 } 6}
users.modify_user
Minimum API version: 12
Changing user settings.
Request parameters:
- user - set of modifiable user attributes, including user ID.
If disabling a user is required, it is recommended to include only essential, for example, only "enabled", changes in the set of attributes to be changed. All user attributes not included in the parameters will remain unchanged after the request has been executed.
Example of request to disconnect user:
1{ 2 "method" : "users.modify_user", 3 "params" : { 4 "user" : { 5 "id" : "00000003", 6 "enabled" : false 7 } 8 }, 9 "version" : 12 10}
Example of request to connect user to a group:
1{ 2 "method" : "users.modify_user", 3 "params" : { 4 "user" : { 5 "id" : "00000003", 6 "group" : "00000002" 7 } 8 }, 9 "version" : 12 10}
Example of request to change list of user’s accessible video devices:
1{ 2 "method" : "users.modify_user", 3 "params" : { 4 "user" : { 5 "id" : "00000003", 6 "video_devices" : [ "4", "12" ] 7 } 8 }, 9 "version" : 12 10}
Example of request to remove restrictions to user’s list of accessible video devices (if the user is included in a group then after the request is executed he will inherit the parent group’s list; if the user is independent of the group, he won’t have any video device restrictions):
1{ 2 "method" : "users.modify_user", 3 "params" : { 4 "user" : { 5 "id" : "00000003", 6 "video_devices" : null 7 } 8 }, 9 "version" : 12 10}
Response Example:
1{ 2 "result" : {} 3}
users.get_groups
Minimum API version: 12
Getting list of server user groups.
Request schema similar to users.get_users.
users.get_group
Minimum API version: 12
Getting user group settings.
Request parameters:
- id - group identifier.
Request schema similar to users.get_user.
users.add_group
Minimum API version: 12
Adding user group.
Request parameters:
- group - set of group attributes.
Request schema similar to users.add_user.
users.remove_group
Minimum API version: 12
Removing user group.
Request parameters:
- id - group identifier.
Request schema similar to users.remove_user.
users.modify_group
Minimum API version: 12
Changing user group settings.
Request parameters:
- group - set of modifiable group attributes, including group identifier.
Request schema similar to users.modify_user.
users.get_user_views
Minimum API version: 12
Getting list of views accessible to user.
Request parameters:
- id - user ID.
Request Example:
1{ 2 "method" : "users.get_user_views", 3 "params" : { "id" : "00000002" }, 4 "version" : 12 5}
users.set_user_views
Minimum API version: 12
Changing set of views accessible to user.
Request parameters:
- id - user identifier;
- views - set of views.
users.get_group_views
Minimum API version: 12
Getting list of views accessible to user group.
Request parameters:
- id - group identifier.
Request Example:
1{ 2 "method" : "users.get_group_views", 3 "params" : { "id" : "00000002" }, 4 "version" : 12 5}
users.set_group_views
Minimum API version: 12
Changing list of views accessible to user group.
Request parameters:
- id - group identifier;
- views - set of views.
Server Configuration
Any changes to the server configuration, for example, a change to the list of users and their rights, camera settings, archive recording parameters etc. are temporary once implemented and can be canceled by a client command or after restarting the server. Changes to server settings can only be fixed to the configuration files by using a client command.
settings.accept
Minimum API version: 13
Saving current server settings to configuration files.
Request Example:
1{ 2 "method" : "settings.accept", 3 "version" : 13 4}
Response Example:
1{ 2 "result" : {} 3}
settings.reset
Minimum API version: 13
Resetting all current server settings to a previous state saved in the configuration files.
Request Example:
1{ 2 "method" : "settings.reset", 3 "version" : 13 4}
Response Example:
1{ 2 "result" : {} 3}
Archive
Archive Timeline
From this point on, timeline is understood to mean bit representation of information about the presence of a recording in the archive: whether there is an archive per unit of time or not. In this definition, the unit of time acts as the timeline’s resolution. The server enables timelines to be obtained with any resolution up to 1 second. The resolution does not have to be a multiple of 1 second, minute, day etc. Any timeline can be calculated precisely, for example, up to 10 seconds, 16 seconds, 2 minutes, 30 minutes, 7 days etc.
Examples of Timelines:- [0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0] – timeline from January 1, 2016 to January 1, 2017 with resolution of 1 month. In this case, it is clear that the archive for February and March is available on the server;
- [1, 0] – timeline from January 1, 2016 to January 1, 2017 with resolution of 6 months. The archive is available for the first half of 2016;
- [0, 1, 0] – timeline from January 1, 2015 to January 1, 2018 with resolution of 1 year. The archive for 2016 is available;
- [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] – timeline for February 2016. The archive for February 5 and 17 is available. Remember when constructing timelines that the number of days for any month of any year is set at 31, i.e. when requesting the timeline for May, June and July the server will return an array of 93 elements, where the element corresponding to June 31 will always equal zero as such a day does not exist.
- [0, 0, 0, 0, 0, 0, 1, 1, 0, 0] – timeline from 00:30 March 10, 2016 to 00:41 March 10, 2016. Archive is available for 00:36 and 00:37.
archive.get_frames_timeline
Getting a timeline.
Request parameters:
- channel – channel identifier is optional: if not specified, all available ones are used;
- stream – stream identifier ("video", "video2", "video3", "audio");
- start_time – timeline start-time;
- end_time – timeline end-time;
- unit_len – timeline resolution in seconds.
Response Example:
- timeline - requested timeline (see description in "Data formats" section).
Request sample for the list of days in February, 2016 where a record for at least one camera is available:
1{ 2 "method" : "archive.get_frames_timeline", 3 "params" : 4 { 5 "start_time" : [2016, 2, 1], 6 "end_time" : [2016, 3, 1], 7 "unit_len" : 86400 //the number of seconds per day - 60 * 60 * 24 8 } 9}
Response Example:
1{ 2 "result" : 3 { 4 "timeline" : [0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0] 5 } 6}
Request sample for the list of minutes for substream archive of camera 0 on the 1st of February, 2016:
1{ 2 "method" : "archive.get_frames_timeline", 3 "params" : 4 { 5 "channel" : 0, 6 "stream" : "video2", 7 "start_time" : [2016, 2, 1], 8 "end_time" : [2016, 2, 2], 9 "unit_len" : 60 10 } 11}
Response Example:
1{ 2 "result" : 3 { 4 "timeline" : [0, 0, 1, ... , 0, 0, 1] //the array consists of 1440 elements 5 } 6}
archive.get_motions_timeline
Gets a timeline by a customised filter: by zone/s of motion detection, object size, object colors(videoanalytics at playback)
Request parameters:
- channel - optional channel identifier(if not set, all available channels are used);
- start_time - begin of time interval;
- end_time - end of time interval (duration of a time interval mustn't be longer than 5 minuties);
- unit_len -a scale of a timeline unit(seconds);
- filter - an object contains of customized filter parameters.
Filter parameters(all parameters are optional):
- min_area - minimal size of detected object( from all size of a frame). Value(float number) from 0.0 to 1.0, for example - 0.1 for detected object not less than 10% from a size of a frame;
- max_area - maximum size of detected object;
- mask64 - 64-bit matrix 8х8 which contains 64 cells of a frame and represented as a string of 64 symbols each of them could be "0" or "1". For example "0000000000010000000000000000000000000000000000000000000000000000", it is requested of an existing of motion detection at the 4th cell at the 2nd row of a frame;
- colors - an array, where each elements consist of an array of 3 numbers, corresponding to RGB-elements of searching color(range [0, 255]).
Response sample:
- timeline - requested timeline (see description in "Data formats" section).
Request sample:
1{ 2 "method" : "archive.get_motions_timeline", 3 "params" : 4 { 5 "start_time" : [2016, 2, 1, 18, 0, 0], 6 "end_time" : [2016, 2, 1, 18, 5, 0], 7 "unit_len" : 60, 8 "filter" : 9 { 10 "min_area" : 0.03, 11 "colors" : [[120, 16, 23], [43, 55, 233]] 12 } 13 } 14}
Response sample:
1{ 2 "result" : 3 { 4 "timeline" : [0, 1, 0, 0, 1] 5 } 6}
archive.get_channels_list
Gets list of cameras, records for which are available in archive, for particular time interval.
Request parameters:
- start_time - begin of time interval;
- end_time - end of time interval.
Response content:
- channels - array of channels, where each element corresponds to one channel.
Every element of “channels” array contains the following fields:
- channel - channel identifier.
Request sample:
1{ 2 "method" : "archive.get_channels_list", 3 "params" : 4 { 5 "start_time" : [2016, 1, 6], 6 "end_time" : [2016, 1, 7] 7 } 8}
Response sample:
1{ 2 "result" : 3 { 4 "channels" : 5 [ 6 { 7 "channel" : 0 8 }, 9 { 10 "channel" : 1 11 } 12 ] 13 } 14}
archive.get_streams_list
Gets streams for particular camera and for particular time interval that are available in archive.
Request parameters:
- channel - channel identifier;
- start_time - begin of time interval;
- end_time - end of time interval.
Response content:
- streams - array of streams, where each elements corresponds to one stream.
Every element of “streams” array contains the following fields:
- stream - stream identifier.
Request sample:
1{ 2 "method" : "archive.get_streams_list", 3 "params" : 4 { 5 "channel" : 0, 6 "start_time" : [2016, 1, 6], 7 "end_time" : [2016, 1, 7] 8 } 9}
Response sample:
1{ 2 "result" : 3 { 4 "streams" : 5 [ 6 { 7 "stream" : "video" 8 }, 9 { 10 "stream" : "video2" 11 }, 12 { 13 "stream" : "video3" 14 }, 15 { 16 "stream" : "audio" 17 }, 18 ] 19 } 20}
archive.get_frames_list
Gets a list of frames.
Request sample:
- channel - channel identifier;
- stream - stream identifier;
- start_time - begin of time interval;
- end_time - end of time interval.
Response content:
- frames_list - array of frames, where each elements corresponds to one frame.
Every element of “frames_list” array contains the following fields:
- id - frame identifier;
- gop_index - ordinal number of a frame at GOP, 0 - I-frame;
- timestamp - frame time.
Request sample: getting list of frames for type "video" and camera 0 at 13:00 on the 1st of March 2016:
1{ 2 "method" : "archive.get_frames_list", 3 "params" : 4 { 5 "channel" : 0, 6 "stream" : "video", 7 "start_time" : [2016, 3, 1, 13, 0], 8 "end_time" : [2016, 3, 1, 14, 0] 9 } 10}
Response sample:
1{ 2 "result" : 3 { 4 "frames_list" : 5 [ 6 { 7 "id" : "f9lk3jfs42df41fsdj4", 8 "gop_index" : 12, 9 "timestamp" : [2016, 3, 1, 13, 11, 43, 543] 10 }, 11 { 12 "id" : "kdj48dh2n", 13 "gop_index" : 13, 14 "timestamp" : [2016, 3, 1, 13, 11, 43, 659] 15 }, 16 ... , 17 { 18 "id" : "ja4wds94dk34", 19 "gop_index" : 2, 20 "timestamp" : [2016, 3, 1, 13, 58, 12, 78] 21 } 22 ] 23 } 24}
archive.get_frame
Gets information about particular frame. This method supports only "application/x-msgpack" format.
Request sample:
- channel - channel identifier;
- stream - stream identifier;
- id - frame identifier.
Response content:
- frame - an object with metadata and information about a frame.
"Frame" object contains the following fields:
- info - object with information about a frame;
- raw_bytes - raw frame data.
Content of an object "info"- video request :
- timestamp - frame timestamp;
- gop_index - ordinal number of a frame at GOP;
- width (might be omited) - frame width;
- height (might be omited) - frame height;
- codec - one of the following values: "h264", "mpeg4", "mjpeg".
Content of an object "info"- audio request:
- timestamp - frame timestamp;
- codec - currently the only possible value is "pcm";
- channels - number of audio channels;
- sps - numbers of samples per second;
- bps - number of bits per second.
Request sample:
1{ 2 "method" : "archive.get_frame", 3 "params" : 4 { 5 "channel" : 0, 6 "stream" : "video", 7 "id" : "deadbeef" 8 } 9}
Response sample:
1{ 2 "result" : 3 { 4 "frame" : 5 { 6 "info" : 7 { 8 "timestamp" : [2016, 12, 23, 12, 54, 26, 943], 9 "gop_index" : 21, 10 "codec" : "h264" 11 }, 12 "raw_bytes" : ... 13 } 14 } 15}
archive.seek_frame
Searching for nearest frame in the archive. Getting frame data only supported in application/x-msgpack format.
Request parameters:
- channel – channel identifier;
- stream – stream identifier;
- start_time – start time for frame search;
- direction – direction of frame search as "forward" or "backward" string;
- read_data – flag indicating need to read frame data from disc as well as information about it.
Response content:
- frame – dictionary with metadata and frame data in the event that "read_data" flag is set.
Content of the "frame" dictionary field corresponds completely to the contents of the dictionary of the same name in response to "archive.get_frame" method.
If the server is unable to find any frames, an error will be returned.
Request Example:
1{ 2 "method" : "archive.seek_frame", 3 "params" : 4 { 5 "channel" : 0, 6 "stream" : "video3", 7 "start_time" : [2016, 12, 1, 13, 0], 8 "read_data" : true, 9 "direction" : "backward" 10 } 11}
Response Example:
1{ 2 "result" : 3 { 4 "frame" : 5 { 6 "info" : 7 { 8 "timestamp" : [2016, 11, 23, 12, 54, 26, 943], 9 "gop_index" : 0, 10 "codec" : "mjpeg" 11 }, 12 "raw_bytes" : ... 13 } 14 } 15}
archive.seek_frames
Search for nearest sequence of frames in the archive.
Additional request parameters regarding "archive.seek_frame":
- quantity - number of resulting sequential frames relating to the first one to meet the given parameters.
Response content:
- frames - an array where each element corresponds to the "frame" dictionary in response to "archive.seek_frame" request.
Custom Event Log
userlog.get_messages
Getting event log messages.
Request parameters:
- backward – reverse order of recordings (new to old), by default: true;
- offset – initial offsetting of message selection, in forward order by default: 0, in reverse order: -1 (most recent message);
- count – maximum number of messages for selection by default: 1000;
- filter – filtering of selection using full-text search algorithm.
Possible filtering fields:
- timestamp – list of substrings for full-text search by message time;
- level – list of substrings for full-text search by message level;
- text – list of substrings for full-text search by message text.
Response content:
- message – array where each element corresponds to one message.
Content of "messages" array element:
- id – message identifier;
- timestamp - time;
- level – level, possible values: "info", "warn", "error";
- text – text.
Example of request for list of messages:
1{ 2 "method" : "userlog.get_messages", 3 "params" : 4 { 5 "count" : 2, 6 "filter" : 7 { 8 "text" : [ "signal Camera+2" ] 9 } 10 } 11}
Response Example:
1{ 2 "result" : 3 { 4 "messages" : 5 [ 6 { 7 "id" : 7297, 8 "level" : "warn", 9 "text" : "Restored signal from camera 'Camera 2'", 10 "timestamp" : [2019,3,26,15,50,14,0] 11 }, 12 { 13 "id" : 7296, 14 "level" : "warn", 15 "text" : "Lost signal from camera 'Camera 2'", 16 "timestamp" : [2019,3,26,15,49,56,0] 17 } 18 ] 19 } 20}
Monitoring of Server State
monitoring.get_server_state
Getting server state (server part of software).
Response content:
- local_time – local server time;
- start_time – time of launch of server part of software.
Request Example:
1{ 2 "method" : "monitoring.get_server_state", 3}
Response Example:
1{ 2 "result" : 3 { 4 "state" : 5 { 6 "local_time" : [2019,3,29,14,34,26,889], 7 "start_time" : [2019,3,29,8,8,29,651] 8 9 } 10 } 11}
monitoring.get_network_state
Response content:
- clients - list of active networks connected to the server.
Content of "clients" array element:
- address – client IP address;
- user – user ID;
- connect_time –connection time;
- archive_access – days in archive to which client was granted access.
Request Example:
1{ 2 "method" : "monitoring.get_network_state", 3}
Response Example:
1{ 2 "result" : 3 { 4 "state" : 5 { 6 "clients" : 7 [ 8 { 9 "address" : "192.168.1.230", 10 "connect_time" : [2019,3,27,8,17,51,418], 11 "user" : "00000000" 12 }, 13 { 14 "address" : "192.168.1.233", 15 "archive_access" : [[2019,3,28],[2019,3,29]], 16 "connect_time" : [2019,3,27,8,17,50,32], 17 "user" : "00000001" 18 } 19 ] 20 } 21 } 22}
monitoring.get_media_state
Response content:
- cameras - dictionary containing state of each server camera.
Content of "cameras" dictionary element:
- enabled - whether camera is enabled or not;
- streams - dictionary containing state of each camera stream.
Content of "streams" dictionary element:
- enabled – whether the stream is enabled or not;
- active – whether media streams are updated or not;
- datarate – average number of data bytes in the stream over the last few seconds;
- framerate – average number of frames in the stream over the last few seconds.
Request Example:
1{ 2 "method" : "monitoring.get_media_state", 3}
Response Example:
1{ 2 "result" : 3 { 4 "state" : 5 { 6 "cameras" : 7 { 8 "0" : 9 { 10 "enabled" : true, 11 "streams" : 12 { 13 "audio" : 14 { 15 "datarate" : 0.0000, 16 "enabled" : false, 17 "framerate" : 0.0000 18 }, 19 "video" : 20 { 21 "active" : true, 22 "datarate" : 49302.3810, 23 "enabled" : true, 24 "framerate" : 4.1667 25 }, 26 "video2" : 27 { 28 "active" : true, 29 "datarate" : 4772.2654, 30 "enabled" : true, 31 "framerate" : 4.1841 32 } 33 } 34 } 35 } 36 } 37 } 38}
monitoring.get_archive_state
Response content:
- storages - list of storages used by server.
Content of "storages" array element:
- path – path to storage;
- available – storage availability flag;
- free_space – amount of free space in megabytes;
- write – dictionary with data about archive record.
Content of "write" dictionary:
- datarate – average number data bytes written to storage over the last few seconds;
- queue_size – maximum relative value for storage write queue size from maximum possible over the last few seconds;
- last_error_time – time of last write error in storage.
Request Example:
1{ 2 "method" : "monitoring.get_archive_state", 3}
Response Example:
1{ 2 "result" : 3 { 4 "state" : 5 { 6 "storages" : 7 [ 8 { 9 "available" : true, 10 "free_space" : 719937, 11 "path" : "X:\\line_archive\\", 12 "write" : 13 { 14 "datarate" : 2186664.4444, 15 "last_error_time" : [2019,3,29,8,1,23,211], 16 "queue_size" : 0.0045 17 } 18 } 19 ] 20 } 21 } 22}
Other
Protocol version
URI: /version
Version: 1.1
MIME-types: application/json
, application/xml
Methods: GET
Protocol version, that will support by this server. Applicable only GET method without parameters of request.
Protocol version in JSON representation:
{ "major": /* number */, "minor": /* number */ }
Protocol version in XML representation:
<version> <major> <!-- xs:int --> </major> <minor> <!-- xs:int --> </minor> </version>
Example for resource's interaction:
GET /version HTTP/1.1 Host: 127.0.0.1 Accept: application/xml
HTTP/1.1 200 OK Date: Mon, 23 May 2005 22:38:34 GMT Content-Type: application/xml <?xml version="1.0" encoding="utf-8"?> <version> <major>2</major> <minor>37</minor> </version>
Change history
Version 1.0
- Names in XML representation was uniformed — lower case symbols, symbol "-" as word splitter.
- Camera's parameters (resolution, color etc.) don’t show in camera representation.
- Determined default values for image request's parameters (resolution, quality etc.).
- Protocol version 0.0 doesn't support now.
Version 1.1
- Added support for "Microphone" object.
- Fixed error of describing tag name like
<xxx-uri>
(in previous version was<xxx-url>
).
Version 1.2
- Added field
<uri>
into Camera object. - Added field
<uri>
into Microphone object. - Added support for "OSD" object (on-screen display).
- Added field
<osd-uri>
into Camera object.
Version 1.3
- Added text color (field
<font-color>
) into OSD object.
Version 1.4
- Added fields
<width>
and<height>
into Camera object. - Added parameter
keep_aspect_ratio
into Image object.
Version 1.5
- Added field
<draw-background>
into OSD object.