Skip to main content
Skip table of contents

Crеate a camera

The method and parameters

To indicate where to create a camera in the tree, you can send both the id from our database and the key that is specified when creating the tree element.

If you need to place the camera in a private folder, you can send both the id from our database and the key that was specified when creating the folder. This folder must be created in the same tree element in which the camera is created.

JSON
{
    "name": "Camera 1",
    "mac": "11:11:11:11:11:11",
    "serial_number": "12345678",
    "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"
    },
    "is_can_manage_archive_storage_days": true,
    "is_archive_enabled": true,
    "log_extra": {
        "some": "information"
    }
}

POST /api/v1/billing/cameras

Parameters

string name, Camera name


string mac, Mac camera address


string serial_number, Camera serial number


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 where the camera should be placed


string|int folder_key, The key of the private folder in which the camera should be placed


bool is_user_owner, Flag that determines whether the camera belongs to the user


double latitude, Latitude at which the camera is located


double longitude, Longitude at which the camera is located


int archive_storage_days, Number of days the archive is stored on the camera


string service, Camera profile, used for applying templates


string external_id, A unique camera identifier that can be used for further access to this camera


array onvif_credentials, Credentials for accessing the camera via onvif


bool is_archive_enabled, Flag that determines whether enable and disable archive recording on camera


string|array log_extra, Additional information received from an 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 object with an error.

JSON
{
    "message": "There will be no informative message here",
    "errors": {
        "any_key": [
            "The cause of the error will be 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",
    "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": [],
    "is_archive_enabled": true,
    "log_extra": "string|array"
}'
PHP
PHP
$data = array (
  'name' => 'string',
  'mac' => 'string',
  'serial_number' => '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,
  'service' => 'string',
  'external_id' => 'string',
  'onvif_credentials' => 
  array (
  ),
  '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);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.