Skip to main content
Skip table of contents

Update a camera with the installed Agent

The method and parameters

The method is used to update a camera device with the installed Agent.

A required permission level is camera-agents.

PATCH /api/admin/v1/camera-agents/{cameraAgent}

The parameters:

int cameraAgent – a unique device identifier.

string name – a device name.

bool is_local_archive_enabled – enable or disable a local archive.

bool is_cloud_archive_enabled – enable or disable a cloud archive.

int cloud_archive_storage_days –  a number of storage days for the cloud archive.

Example:

JSON
{
    "name": "name-updated",
    "is_local_archive_enabled": false,
    "is_cloud_archive_enabled": false,
    "cloud_archive_storage_days": 80
}
cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/admin/v1/camera-agents/{cameraAgent}' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "cameraAgent": 0,
    "name": "string",
    "is_local_archive_enabled": true,
    "is_cloud_archive_enabled": true,
    "cloud_archive_storage_days": 0
}'
PHP
PHP
$data = array (
  'cameraAgent' => 0,
  'name' => 'string',
  'is_local_archive_enabled' => true,
  'is_cloud_archive_enabled' => true,
  'cloud_archive_storage_days' => 0,
);
$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/admin/v1/camera-agents/{cameraAgent}', 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 device object.

JSON
{
    "id": 1,
    "name": "name-updated",
    "uuid": "bfa7581e-8111-4602-b40b-6e690a999580",
    "mac": "mac1",
    "serial_number": "serial1",
    "status": "activated",
    "is_online": false,
    "version": "3.4",
    "created_at": "2024-06-04T12:36:42.000000Z",
    "updated_at": "2024-06-04T12:40:43.000000Z",
    "last_updated_at": null,
    "storages": [
        {
            "id": 1,
            "path": "/storage",
            "usage": 33.333,
            "capacity": 0.03
        }
    ],
    "camera": {
        "id": 1,
        "group_id": 1,
        "status": "active",
        "type": "mediaagent",
        "start_at": null,
        "created_at": "2024-06-04T12:36:42.000000Z",
        "name": "name-1-updated",
        "streams": [
            {
                "id": 1,
                "type": "high",
                "camera_id": 1,
                "status": null,
                "url": "rtsp://admin:pass@server.local:554/Streaming/Channels/101",
                "bitrate": null,
                "resolution": null,
                "output_rate": null,
                "ip": "192.168.7.20",
                "uuid": "98fdc101-a1e7-4751-b439-d482ac083b4b",
                "streams_count": null,
                "created_at": "2024-06-04T12:36:42.000000Z",
                "updated_at": "2024-06-04T12:36:42.000000Z",
                "is_preview_from_server": true,
                "is_archive_from_server": null,
                "is_enabled": true,
                "is_can_transfer": true,
                "source": "manual",
                "is_sound_enabled": null,
                "reconnect_attempt": null,
                "reconnect_total": null,
                "reconnect_time": null,
                "disconnections_count": 0,
                "is_actual": true,
                "condition": "active",
                "stopped_at": "",
                "video_codec": null,
                "audio_codec": null
            },
            {
                "id": 2,
                "type": "low",
                "camera_id": 1,
                "status": null,
                "url": "rtsp://admin:pass@server.local:554/Streaming/Channels/102",
                "bitrate": null,
                "resolution": null,
                "output_rate": null,
                "ip": "192.168.7.20",
                "uuid": "632b4b95-1641-4061-8bf6-32311b7f263d",
                "streams_count": null,
                "created_at": "2024-06-04T12:36:42.000000Z",
                "updated_at": "2024-06-04T12:36:42.000000Z",
                "is_preview_from_server": true,
                "is_archive_from_server": null,
                "is_enabled": true,
                "is_can_transfer": true,
                "source": "manual",
                "is_sound_enabled": null,
                "reconnect_attempt": null,
                "reconnect_total": null,
                "reconnect_time": null,
                "disconnections_count": 0,
                "is_actual": true,
                "condition": "active",
                "stopped_at": "",
                "video_codec": null,
                "audio_codec": null
            }
        ],
        "can_edit": true,
        "origin": null,
        "group_type": "public",
        "ip": "127.0.0.1",
        "lat": null,
        "lng": null,
        "azimuth": null,
        "is_sensitive": false,
        "is_buffer_enabled": false,
        "is_public": 0,
        "is_ip_reserved": false,
        "count_issues": 0,
        "source": "manual",
        "archive_storage_days": 80,
        "is_archive_recording": false,
        "archive_recording_type": "fulltime",
        "is_local_archive_enabled": false,
        "local_archive_storage_days": 30,
        "is_increased_reconnect": 0,
        "is_sound_enabled": true,
        "is_bridge": false,
        "is_agent": true,
        "is_auto_create_streams": false,
        "is_provisioning_enable": false,
        "is_can_manage_streams": true,
        "streams_source": "manual",
        "is_editable": true,
        "status_changed_at": null,
        "is_intercom": false,
        "deleted_at": null,
        "is_need_replace": false
    }
}
  • Error responses:

401 Unauthorized

The authorization token is invalid or isn’t submitted.

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.