26.06 26.05 25.12
26.06 26.05 25.12 Russian English

Get DVR ranges: Stream.Dvr.Ranges

The method and parameters

With the Stream.Dvr.Ranges method, you can get DVR ranges of each stream where recording is enabled.

string Stream.Dvr.Ranges(CamerasObject cameras, unsigned ttl)

The parameters

CamerasObject cameras  required – the list of cameras

object CamerasObject

array cameras.camera-uid-0 = ["0", "1"] – ranges for camera-uid-0.


array cameras.camera-uid-1 = ["2", "3"] – ranges for camera-uid-1.


unsigned ttl – the time during which the range is available. When 0 is set, the duration is unlimited.

POST  /api/

JSON-RPC
JSON
{
    "jsonrpc": "2.0",
    "method": "Stream.Dvr.Ranges",
    "params": {
        "cameras": {
            "camera-uid-0": [
                "0",
                "1"
            ],
            "camera-uid-1": [
                "2",
                "3"
            ]
        },
        "ttl": 0
    },
    "id": 1
}
cURL
Bash
curl -k --request POST \
	--url 'https://your-domain/api/' \
	--header 'Content-Length: 315' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--header 'Authorization: Bearer <api-authorization-token>' \
	--header 'Content-Length: <data length>' \
	--data '{
    "jsonrpc": "2.0",
    "method": "Stream.Dvr.Ranges",
    "params": {
        "cameras": {
            "camera-uid-0": [
                "0",
                "1"
            ],
            "camera-uid-1": [
                "2",
                "3"
            ]
        },
        "ttl": 0
    },
    "id": 1
}'
PHP
PHP
$data = array (
  'jsonrpc' => '2.0',
  'method' => 'Stream.Dvr.Ranges',
  'params' => 
  array (
    'cameras' => 
    array (
      'camera-uid-0' => 
      array (
        0 => '0',
        1 => '1',
      ),
      'camera-uid-1' => 
      array (
        0 => '2',
        1 => '3',
      ),
    ),
    'ttl' => 0,
  ),
  'id' => 1,
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'POST',
		'header' => "Content-Type: application/json\r
Accept: application/json\r
Authorization: Bearer <api-authorization-token>\r
Content-Length: <data length>",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/', false, $context);

200  OK

A list of objects specifying the start and end of stream archive segments

JSON
[
    "<stream-uid-1>",
    "<stream-uid-N>"
]

400  Bad Request

The JSON-RPC error

JSON
{
    "error": {
        "code": -32601,
        "message": "Method not found"
    }
}

500  Internal Server Error

The server error