API for network-DVR service management
Description
This API provides an interface to manage network-DVR (temporary stream recording on the receiving device).
The API allows to get information about DVR ranges (recorded periods in DVR archive) for the stream and to delete them.
API
General information
- Required headers: CDN-AUTH-TOKEN (authorization token, refer. Authorization)
- Data in request body is sent in JSON format (Content-Type: application/json)
In case of correct response API returns 2xx response code and response text in the following format:
{ "status": "Completed", "data": <API response>, "<request parameter 1>": "value1", "<request parameter 2>": "value2" }
In case of an error response, the API returns the corresponding response code and the response text in the following format:
{ "status": "Forbidden", "description": "Token is expired" }
The description
field returns a text description of the error.
Get information for specific stream
URL: https://api.cdnvideo.ru/app/dvr-net/v1/<your_account_name>/streams/<stream_name>
- Request type: GET
- Headers: CDN-AUTH-TOKEN
- Request parameters: no request parameters
- Response data type: JSON Object
- Response parameters:
Parameter | Description |
---|---|
stream_name | Stream name |
host | Server |
is_alive | is the stream alive |
dvr | DVR parameters block for the stream |
dvr.enabled | Is the DVR enabled for the stream |
dvr.window | DVR depth |
dvr.duration | Total duration of the recorded DVR excluding any breaks in recording |
dvr.from | UTC timestamp of the first DVR recording |
dvr.ranges | List of recorded DVR periods |
dvr.ranges.duration | DVR period duration |
dvr.ranges.from | UTC timestamp of the beginning of the DVR period |
Request example
curl -H "CDN-AUTH-TOKEN: $TOKEN" 'https://api.cdnvideo.ru/app/dvr-net/v1/testaccount/streams/test/stream1'
Response example
{ "status": "Completed", "stream_name": "test/stream1", "data": [ { "stream_name": "test/stream1", "host": "ffce3977afe64227676096887231adba", "is_alive": false, "dvr": { "enabled": true, "window": 3600, "duration": 60, "from": 1668753181, "ranges": [ { "duration": 27, "from": 1668753181 }, { "duration": 33, "from": 1668753302 } ] } }, { "stream_name": "test/stream1", "host": "7bd5e6ccea2e689d252eb4c183a1aaf6", "is_alive": false, "dvr": { "enabled": true, "window": 3600, "duration": 60, "from": 1668753181, "ranges": [ { "duration": 27, "from": 1668753181 }, { "duration": 33, "from": 1668753302 } ] } } ] }
Delete DVR range for specific stream
Any part of DVR can be deleted to the accuracy of a second, i.e. it is possible to delete a piece of DVR in the middle of DVR range, left, right (and left and right borders may be specified outside existing ranges).
The active DVR can be deleted too, in which case the list becomes empty at first and then accumulates again.
If deletion fails on at least one of the list of nodes, a 500 error is returned. In this case, in addition to the status
field, the failed_hosts
field appears in the response with the list of nodes on which the removal failed.
URL: https://api.cdnvideo.ru/app/dvr-net/v1/<your_account_name>/streams/<stream_name>
- Request type: DELETE
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Object
- Request parameters:
Parameter | Description |
---|---|
duration_sec | Duration of the DVR chunk you are deleting |
host | Server |
from_ts | UTC timestamp from which the DVR chunk should be deleted |
to_ts | UTC timestamp to which the DVR chunk should be deleted |
Required are host
, from_ts
and any one of (duration_sec
, to_ts
).
If it is necessary to remove the DVR on all nodes, an "asterisk" must be specified as the value of the host
parameter.
Request example
curl -X DELETE -d '{"host": "7bd5e6ccea2e689d252eb4c183a1aaf6", "from_ts": 1668753181, "duration_sec": 15}' -H "cdn-auth-token: $TOKEN" -H "Content-Type: application/json" 'https://api.cdnvideo.ru/app/dvr-net/v1/testaccount/streams/test/stream1'
Response example
{ "status": "Completed", "stream_name": "test/stream1", "duration_sec": 15, "from_ts": 1668753181, "host": "7bd5e6ccea2e689d252eb4c183a1aaf6" }
Delete all accumulated DVR for specific stream
If the deletion fails on at least one of the list of nodes, a 500 error is returned. In this case, in addition to the status
field, the failed_hosts
field appears in the response with the list of nodes on which the deletion failed.
URL: https://api.cdnvideo.ru/app/dvr-net/v1/<your_account_name>/streams/<stream_name>
- Request type: DELETE
- Headers: CDN-AUTH-TOKEN
- Response data type: JSON Object
- Request parameters:
Parameter | Description |
---|---|
all | Flag of deletion of all accumulated DVR |
host | Server |
Both parameters are required.
If it is necessary to remove the DVR on all nodes, an "asterisk" must be specified as the value of the host
parameter.
Request example
curl -X DELETE -d '{"host": "*", "all": true}' -H "cdn-auth-token: $TOKEN" -H "Content-Type: application/json" 'https://api.cdnvideo.ru/app/dvr-net/v1/testaccount/streams/test/stream1'
Response example
{ "status": "Completed", "stream_name": "test/stream1", "host": "*", "all": true }