26.09 26.06 26.05 25.12
26.09 26.06 26.05 25.12 Russian English

Update camera by external system (legacy)

With the release of the new request version v2, version v1 is moved to legacy.
For new integrations, use the current version v2.
Version v1 remains available to support existing integrations.

PATCH  /api/v1/billing/cameras

The camera is identified by id, mac or external_id

If thehighstream hasn't been created yet, its settings are applied when it is created automatically; if the stream already exists, the archive settings are 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,
        "ip": "192.168.1.100",
        "network": "direct",
        "network_scope": "local",
        "nat_port": 8080
    },
    "start_provisioning": true,
    "is_can_manage_archive_storage_days": false,
    "is_archive_enabled": true,
    "is_enabled": true,
    "log_extra": {
        "some": "information"
    }
}

Method parameters

string id, Current camera id


string external_id, Current camera external_id


string mac, Current camera MAC address


string new_mac, New camera MAC address


string serial_number, New camera serial number


string service, Camera profile, used to apply templates


array profile, Additional camera data


string name, Camera name


string group_type, Camera group type


int group_id, ID of the tree element in which to create the camera


string|int group_external_id, Key of the tree element in which to create the camera


int folder_id, ID of the private folder in which to place the camera


string|int folder_key, Key of the private folder in which to place the camera


bool is_user_owner, Flag indicating whether the camera belongs to a user


double latitude, Latitude of the camera location


double longitude, Longitude of the camera location


int archive_storage_days, Number of days to retain the camera archive (applies to the "high" stream; required if is_archive_enabled is enabled)


array onvif_credentials, Credentials for accessing the camera through ONVIF

object array

string onvif_credentials.ip, ONVIF device IP address. If omitted, the IP address of the camera's network device is used


string onvif_credentials.login, Login for accessing camera ONVIF


int onvif_credentials.nat_port, ONVIF NAT port (1–65535)


string onvif_credentials.network, ONVIF connection mode: `direct` or `proxy`


string onvif_credentials.network_scope, ONVIF network scope: `local`, `intranet`, or `internet`


string onvif_credentials.password, Password for accessing camera ONVIF


int onvif_credentials.port, Port for accessing camera ONVIF


bool start_provisioning, Start ONVIF provisioning after updating the camera. Requires onvif_credentials.port and an IP address (from the request or network device); returns 422 if they are missing


bool is_archive_enabled, Flag that enables or disables the archive for the "high" stream


bool is_enabled, Flag that disables or enables camera video stream capture. When capture is disabled, the recorded archive remains available.


string|array log_extra, Additional information received from the external system

201  Created

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 error object.

For more information, seeGeneral information > Validation.

JSON
{
    "message": "No informative message is provided here",
    "errors": {
        "any_key": [
            "The reason for the error is described here"
        ]
    }
}
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": {
        "ip": "string",
        "login": "string",
        "password": "string",
        "port": 0,
        "network": "string",
        "network_scope": "string",
        "nat_port": 0
    },
    "onvif_credentials.ip": "void",
    "onvif_credentials.login": "void",
    "onvif_credentials.password": "void",
    "onvif_credentials.port": "void",
    "onvif_credentials.network": "void",
    "onvif_credentials.network_scope": "void",
    "onvif_credentials.nat_port": "void",
    "start_provisioning": true,
    "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 (
    'ip' => 'string',
    'login' => 'string',
    'password' => 'string',
    'port' => 0,
    'network' => 'string',
    'network_scope' => 'string',
    'nat_port' => 0,
  ),
  'onvif_credentials.ip' => 'void',
  'onvif_credentials.login' => 'void',
  'onvif_credentials.password' => 'void',
  'onvif_credentials.port' => 'void',
  'onvif_credentials.network' => 'void',
  'onvif_credentials.network_scope' => 'void',
  'onvif_credentials.nat_port' => 'void',
  'start_provisioning' => true,
  '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);