Export start
Export is initiated using one of the following POST requests:
http://IP-Address:port/prefix/export/archive/SERVER1/VIDEOSOURCEID/BEGINTIME/ENDTIME - archive export
http://IP-Address:port/prefix/export/live/SERVER1/VIDEOSOURCEID/BEGINTIME/ENDTIME - live video export
where BEGINTIME and ENDTIME set time in the YYYYMMDDTHHMMSS format. If BEGINTIME is greater than ENDTIME, then the values will swap. BEGINTIME must be equal to ENDTIME for snapshot export.
Complex data structures are in use to describe frames and masks. These structures can be divided into several types:
- point is set using x,y syntax: sample - [0.5, 0.5].
- area sets square frame; defined by two points ! separated. Sample - [[0.5, 0.5], [0.4,0.4]].
- polygon sets closed curve; contains at least 3 points enclosed in []. Sample - [[0.5, 0.5], [0.4,0.4],[0.3,0.3]].
- mask is a collection of polygons. Sample - [[[0.5, 0.5],[0.6, 0.6],[0.7, 0.7]], [[0.1, 0.1],[0.2, 0.2],[0.3, 0.3]]].
Supported parameters that are sent in the body of initial POST request:
The request will result in an error response or response that looks like:
HTTP/1.1 202 Accepted Connection: Close Location: /export/3dc15b75-6463-4eb1-ab2d-0eb0a8f54bd3 Cache-Control: no-cache
Note.
Possible error codes:
- 400 - incorrect request.
- 500 - Server internal error.
Get export status
GET http://IP-Address:port/prefix/export/id/status
where id is the value from the Location field (here 3dc15b75-6463-4eb1-ab2d-0eb0a8f54bd3)
Sample response:
{ "id": "73c2e1d2-0f8f-414c-9cc0-ac5fb43cd8dd" ,"state": 1 ,"progress": 0.51062298 ,"error": "" ,"files": [ ] }
where
- state defines the current state of export. Available values:
1 – export is performed
2 – export is completed
3 – export error
4 – not enough space to complete the operation - progress – progress of export session in the range from 0 to 1.
- error – description of error (if any)
- files - the list of files created as the export result
Export completion
DELETE http://IP-Address:port/prefix/export/id
where id is the value from the Location field.
Download file
GET http://IP- Address:port/prefix/export/id/file?name=SERVER_DeviceIpint.1[20160527T132900-20160527T133000].mkv
where
- id is the value from the Location field
- file?name is the name of file from the files field