Skip to main content
Skip table of contents

Add and activate a user's camera with Agent

The method and parameters

The method is used to add and activate a user’s camera with the installed Agent software.

A required permission level is camera-agents.

POST /api/admin/v1/camera-agents/users/{user}

The parameters:

int user – a unique user identifier.

string name – a device name.

string mac– a MAC address of a device. It is required when a serial number isn’t specified. It’s unique among the devices that are added by the user.

string serial_number – a serial number of a device. It’s required when a MAC address isn’t specified.

JSON
{
    "name": "camera_agent_name",
    "mac": "08:13:c0:00:00:82",
    "serial_number": "serial_number"
}
cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/admin/v1/camera-agents/users/{user}' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "user": 0,
    "name": "string",
    "mac": "string",
    "serial_number": "string"
}'
PHP
PHP
$data = array (
  'user' => 0,
  'name' => 'string',
  'mac' => 'string',
  'serial_number' => 'string',
);
$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/admin/v1/camera-agents/users/{user}', false, $context);

Responses

A detailed list of response codes is in the General description API documentation section.

  • A successful response:

200 – a successful response

200 OK

Returns the camera agent object.

JSON
{
    "id": 1,
    "name": "camera_agent_name",
    "uuid": "d2ba9774-eb19-4654-9bfd-037b58e93af4",
    "mac": "mac1",
    "serial_number": "serial_number",
    "status": "activated",
    "is_online": false,
    "version": "3.4",
    "last_updated_at": null,
    "created_at": "2024-05-27T12:55:49.000000Z",
    "updated_at": "2024-05-27T12:55:49.000000Z",
    "storages": [
        {
            "id": 1,
            "path": "/storage",
            "usage": 33.333,
            "capacity": 0.03
        }
    ],
    "camera": {
        "id": 1,
        "group_id": 1,
        "status": "initial",
        "type": "mediaagent",
        "start_at": null,
        "created_at": "2024-05-27T12:55:49.000000Z",
        "billing_id": null,
        "pretty_name": "camera-name",
        "original_name": "camera-name",
        "lat": null,
        "lng": null,
        "azimuth": null,
        "streams": [
            {
                "id": 1,
                "type": "high",
                "camera_id": 1,
                "url": "rtsp://admin:pass@server.local:554/Streaming/Channels/101",
                "is_preview_from_server": true,
                "is_archive_from_server": null,
                "status": null,
                "has_sound": false,
                "width": null,
                "height": null,
                "video_codec": null,
                "audio_codec": null
            },
            {
                "id": 2,
                "type": "low",
                "camera_id": 1,
                "url": "rtsp://admin:pass@server.local:554/Streaming/Channels/102",
                "is_preview_from_server": true,
                "is_archive_from_server": null,
                "status": null,
                "has_sound": false,
                "width": null,
                "height": null,
                "video_codec": null,
                "audio_codec": null
            }
        ],
        "has_sound": false,
        "archive_recording_type": "fulltime",
        "can_change_archive_timetable": false,
        "is_bridge": false,
        "is_agent": true,
        "is_intercom": false,
        "is_cloud_archive_enabled": false,
        "is_local_archive_enabled": false,
        "cloud_archive_storage_days": 0,
        "local_archive_storage_days": 0,
        "ip": "127.0.0.1",
        "port": 554,
        "is_favorite": false,
        "is_restricted_live": null,
        "is_restricted_archive": null,
        "user_status": "active",
        "note": null,
        "name": "qwe-name"
    }
}
  • Error responses:

401 Unauthorized

The authorization token is invalid or isn’t submitted.

403 Forbidden

This means that the administrator, or the user for whom the camera with the installed Agent is to be activated, doesn’t have the necessary access rights.

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"
        ]
    }
}

JavaScript errors detected

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

If this problem persists, please contact our support.