Skip to main content
Skip table of contents

Обновление скрипта

Обновление скрипта

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

Параметры метода

int script, уникальный идентификатор скрипта


int event_id, id существующего события


int reaction_id, id реакции


array users, массив id существующих пользователей, которые получат push-уведомление при срабатывании скрипта


array schedule, расписание, по которому будет работать скрипт

object array

date schedule. REQUIRED, .ranges.*.to конец интервала времени


date schedule. REQUIRED, .ranges.*.to конец интервала времени


date schedule. REQUIRED, .ranges.*.to конец интервала времени


date schedule. REQUIRED, .ranges.*.to конец интервала времени


200 OK

Успешный ответ

JSON
{
    "id": 902,
    "event": {
        "id": 41,
        "name": "person_counting",
        "description": "Подсчет людей в области",
        "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

Токен авторизации не передан или не валидный Получение токена

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.