26.09 26.06 26.05 25.12
26.09 26.06 26.05 25.12 Russian English

Create 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.

POST  /api/v1/billing/cameras

To specify where in the tree to create the camera, provide either theidfrom our database or the key specified when creating the tree element.VMS Billing / Tree / Create a tree element

To place the camera in a private folder, provide either theidfrom our database or the key specified when creating the folder. The folder must be created in the same tree element as the camera.VMS Billing / Tree / Folders / Create a private folder

JSON
{
    "name": "Camera 1",
    "mac": "11:11:11:11:11:11",
    "serial_number": "12345678",
    "intercom_id": 5,
    "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,
    "service": "8MP",
    "external_id": "unique_id",
    "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": true,
    "is_archive_enabled": true,
    "log_extra": {
        "some": "information"
    }
}

Method parameters

string name, Camera name


string mac, Camera MAC address (optional if intercom_id is specified)


string serial_number, Camera serial number


int intercom_id, ID of the intercom for which the camera is created


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)


string service, Camera profile, used to apply templates


string external_id, Unique camera identifier that can be used to refer to the camera later


array onvif_credentials, Credentials for accessing the camera through ONVIF

object array

string onvif_credentials.ip, ONVIF device IP address (required when start_provisioning=true)


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`


bool start_provisioning, Start ONVIF provisioning after creating the camera. Requires onvif_credentials.ip and onvif_credentials.port; returns 422 if they are missing


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


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.External system 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 POST \
	--url 'https://your-domain/api/v1/billing/cameras' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "name": "string",
    "mac": "string",
    "serial_number": "string",
    "intercom_id": 0,
    "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,
    "service": "string",
    "external_id": "string",
    "onvif_credentials": {
        "ip": "string",
        "network": "string",
        "network_scope": "string",
        "nat_port": 0
    },
    "onvif_credentials.ip": "void",
    "onvif_credentials.network": "void",
    "onvif_credentials.network_scope": "void",
    "onvif_credentials.nat_port": "void",
    "start_provisioning": true,
    "is_archive_enabled": true,
    "log_extra": "string|array"
}'
PHP
PHP
$data = array (
  'name' => 'string',
  'mac' => 'string',
  'serial_number' => 'string',
  'intercom_id' => 0,
  '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,
  'service' => 'string',
  'external_id' => 'string',
  'onvif_credentials' => 
  array (
    'ip' => 'string',
    'network' => 'string',
    'network_scope' => 'string',
    'nat_port' => 0,
  ),
  'onvif_credentials.ip' => 'void',
  'onvif_credentials.network' => 'void',
  'onvif_credentials.network_scope' => 'void',
  'onvif_credentials.nat_port' => 'void',
  'start_provisioning' => true,
  'is_archive_enabled' => true,
  'log_extra' => 'string|array',
);
$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/billing/cameras', false, $context);