Creating a script
Creating a script
This functionality with scripts is used together with the integration module. Requests are received from the integration module indicating an event that occurred on the camera. Depending on the settings, scripts are executed.
POST /api/admin/v1/scripts |
Method parameters
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
date
schedule. REQUIRED, .ranges.*.to end of time interval
date
schedule. REQUIRED, .ranges.*.to end of time interval
date
schedule. REQUIRED, .ranges.*.to end of time interval
date
schedule. REQUIRED, .ranges.*.to end of time interval
200 |
Successful response
JSON
|
401 |
Authorization token is not provided or is invalid. Obtaining a token |
curl -k --request POST \
--url 'https://your-domain/api/admin/v1/scripts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"event_id": 0,
"reaction_id": 0,
"users": [],
"schedule": {
"": "date"
},
"schedule.": "void"
}'
$data = array (
'event_id' => 0,
'reaction_id' => 0,
'users' =>
array (
),
'schedule' =>
array (
'' => 'date',
),
'schedule.' => 'void',
);
$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/scripts', false, $context);