Skip to main content
Skip table of contents

Script update

Script update

PUT /api/admin/v1/scripts/{script}

Method parameters

int script, unique identifier of the script


int event_id, ID of an existing event


int reaction_id, ID of the reaction


array users, array of IDs of existing users who will receive push notifications when the script is triggered


array schedule, schedule on which the script will operate

object array

date schedule. REQUIRED, .ranges.*.to end time of the time interval


date schedule. REQUIRED, .ranges.*.to end time of the time interval


date schedule. REQUIRED, .ranges.*.to end time of the time interval


date schedule. REQUIRED, .ranges.*.to end time of the time interval


200 OK

Successful response

JSON
{
    "id": 902,
    "event": {
        "id": 41,
        "name": "person_counting",
        "description": "Counting people in the area",
        "color": "#FF7CF2",
        "analytic_type": "person_counting"
    },
    "reaction": null,
    "users": [
        {
            "id": 3,
            "name": "user",
            "login": "user",
            "created_at": "2021-05-27 15:43:37",
            "updated_at": "2022-05-06 14:19:13",
            "expired_at": null,
            "is_licence_limit_reached": false,
            "ptz_priority": 10,
            "access_token_id": null
        },
        {
            "id": 4,
            "name": "user",
            "login": "user",
            "created_at": "2021-05-27 15:43:37",
            "updated_at": "2022-05-06 14:19:13",
            "expired_at": null,
            "is_licence_limit_reached": false,
            "ptz_priority": 10,
            "access_token_id": null
        },
        {
            "id": 19,
            "name": "user",
            "login": "user",
            "created_at": "2021-08-11 17:35:13",
            "updated_at": "2021-09-20 17:30:28",
            "expired_at": null,
            "is_licence_limit_reached": false,
            "ptz_priority": 10,
            "access_token_id": null
        }
    ],
    "schedule": [
        {
            "day": 0,
            "ranges": [
                {
                    "to": "23:59:59",
                    "from": "00:00:00"
                }
            ]
        }
    ],
    "created_at": "2022-02-18 18:01:54",
    "updated_at": "2022-02-18 18:02:52"
}

401 Unauthorized

Authorization token is not provided or is invalid. Obtaining a token

cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/admin/v1/scripts/{script}' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "script": 0,
    "event_id": 0,
    "reaction_id": 0,
    "users": [],
    "schedule": {
        "": "date"
    },
    "schedule.": "void"
}'
PHP
PHP
$data = array (
  'script' => 0,
  'event_id' => 0,
  'reaction_id' => 0,
  'users' => 
  array (
  ),
  'schedule' => 
  array (
    '' => 'date',
  ),
  'schedule.' => 'void',
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'PUT',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/admin/v1/scripts/{script}', false, $context);
JavaScript errors detected

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

If this problem persists, please contact our support.