Breadcrumbs

URLs to preview Live and Archive from cameras

The method and parameters

POST  /api/v1/cameras/preview

The expired_at field indicates the expiration time of the link token.

As part of this request, you can include the user's integration token. If the camera is accessible to the user, a URL to the archived footage will be generated.

JSON
{
    "cameras": [
        {
            "uuid": "uuid",
            "stream_type": "high",
            "date": "2000-01-01T00:00:00Z"
        }
    ],
    "source": "mp4",
    "ttl": "100"
}

array cameras  required – an array of UUIDs of cameras for which you are retrieving links. Each camera object has the following properties:

  • uuid – the UUID of the camera for which the link is to be generated. This field is required.

  • stream_type – a type of the video stream. If omitted or set to camera, the link will be generated for this camera. If the stream type is specified, the link will be generated for that particular stream type.

  • date – this field is used to generate the archive link and specifies the start date of the archive.


string source  required – a link type.

  • mp4 - a short preview in MP4 format (default value).

  • jpg - a preview image in JPG format.


int ttl – a link lifetime in seconds.

200  OK

A successful response with all parameters

[ { "url": "http://127.0.0.1/test", "expired_at": "2000-01-01T00:00:00.000000Z" } ]

401  Unauthorized

When an authorization token is passed but is invalid

cURL
Bash
curl -k --request POST \
	--url 'https://your-domain/api/v1/cameras/preview' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "cameras": [],
    "source": "string",
    "ttl": 0
}'
PHP
PHP
$data = array (
  'cameras' => 
  array (
  ),
  'source' => 'string',
  'ttl' => 0,
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'POST',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/v1/cameras/preview', false, $context);