Breadcrumbs

Udate a cаmera by an external system (v1)

The method and parameters

With the release of the new version (v2) of this request, v2 is now the current and recommended version. Support for v1 will continue for six months following the release of v2. After this period, v1 will be deprecated and no longer supported.

PATCH  /api/v1/billing/cameras

The camera is searched by id, mac or external_id.

If the high stream doesn’t exist yet, the settings will be applied during its automatic creation.
If the stream already exists, archive parameters will be updated immediately.

JSON
{
    "id": 1,
    "external_id": "bd0a951f-40a2-4edf-b213-bcd90ff5273d",
    "mac": "12:12:12:12:12:11",
    "new_mac": "12:12:12:12:12:12",
    "serial_number": "111111111111",
    "service": "8MP",
    "profile": "[1,0]",
    "name": "Camera 1",
    "group_type": "private",
    "group_id": 16,
    "group_external_id": 16,
    "folder_key": 123,
    "folder_id": 3,
    "is_user_owner": false,
    "latitude": -28.776933731993793,
    "longitude": 76.65771489519997,
    "archive_storage_days": 5,
    "onvif_credentials": {
        "login": "login",
        "password": "password",
        "port": 80
    },
    "is_can_manage_archive_storage_days": false,
    "is_archive_enabled": true,
    "is_enabled": true,
    "log_extra": {
        "some": "information"
    }
}

The parameters

string id – the ID of a current camera.


string external_id – a current external_id of a camera.


string mac – a current MAC address of a camera.


string new_mac – a new MAC address of a camera.


string serial_number – a new serial number of a camera.


string service – a camera profile used to apply configuration templates.


array profile – additional camera details.


string name – a camera name.


string group_type – a camera group type.


int group_id – an ID of a tree element where the camera will be created.


string|int group_external_id – a key of the tree element in which to create the camera


int folder_id, Id of the private folder where the camera should be placed


string|int folder_key – a private folder ID where the camera will be placed.


bool is_user_owner – a flag that indicates if the camera is assigned to a user.


double latitude – denotes the latitude of the camera's location.


double longitude – denotes the longitude of the camera's location.


int archive_storage_days – a number of days the archive is stored for the camera (applies to the high stream, required if is_archive_enabled is enabled).


array onvif_credentials – credentials to access the camera via ONVIF.


bool is_archive_enabled – a flag to enable or disable the archive recording for the high stream.


bool is_enabled – a flag to enable or disable camera stream capture. When capture is disabled, archive recordings remain available.


string|array log_extra – additional information received from an external system.

201  Created

A successful response

JSON
{
    "id": 26,
    "status": "empty",
    "name": "Camera 1",
    "is_archive_recording": true,
    "archive_storage_days": 5,
    "group_type": "private",
    "is_user_owner": false,
    "is_need_replace": false,
    "latitude": -28.776933731993793,
    "longitude": 76.65771489519997,
    "network_device": {
        "mac": "11:11:11:11:11:11",
        "serial_number": "12345678"
    },
    "folder": {
        "id": 3,
        "key": "123"
    }
}

422  Unprocessable Entity

Returns a JSON object with an error. For details, see General information > Validation.

JSON
{
    "message": "No error message here",
    "errors": {
        "any_key": [
            "Error details"
        ]
    }
}
cURL
Bash
curl -k --request PATCH \
	--url 'https://your-domain/api/v1/billing/cameras' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "id": "string",
    "external_id": "string",
    "mac": "string",
    "new_mac": "string",
    "serial_number": "string",
    "service": "string",
    "profile": [],
    "name": "string",
    "group_type": "string",
    "group_id": 0,
    "group_external_id": "string|int",
    "folder_id": 0,
    "folder_key": "string|int",
    "is_user_owner": true,
    "latitude": 0,
    "longitude": 0,
    "archive_storage_days": 0,
    "onvif_credentials": [],
    "is_archive_enabled": true,
    "is_enabled": true,
    "log_extra": "string|array"
}'
PHP
PHP
$data = array (
  'id' => 'string',
  'external_id' => 'string',
  'mac' => 'string',
  'new_mac' => 'string',
  'serial_number' => 'string',
  'service' => 'string',
  'profile' => 
  array (
  ),
  'name' => 'string',
  'group_type' => 'string',
  'group_id' => 0,
  'group_external_id' => 'string|int',
  'folder_id' => 0,
  'folder_key' => 'string|int',
  'is_user_owner' => true,
  'latitude' => 0.0,
  'longitude' => 0.0,
  'archive_storage_days' => 0,
  'onvif_credentials' => 
  array (
  ),
  'is_archive_enabled' => true,
  'is_enabled' => true,
  'log_extra' => 'string|array',
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'PATCH',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/v1/billing/cameras', false, $context);