Group Token for Amazon Rekognition
To create a group token with the support of the AI adapter we should use api/v3/channel_groups/ endpoint. Before using examples please replace parameters in {} with yours.
Creating a group token with AWS Rekognition detection label.
This example will create a group token that contains only one camera with id=11235. Also, this token will use AWS Rekognition ("ai_engine": "aws") with a detection label ("ai_type": "object_and_scene_detection") and it will poll images from the server once every 180 seconds ("ai_period": 180). Also inside of AI parameters ("ai_params") we will define the following parameters:
access_key - AWS ACCESS KEY which allows using AWS Rekognition service.
secret_key - AWS SECRET KEY which allows using AWS Rekognition service.
filter - one of the common parameters which can be used for image filtration (it's the same as the "origin" parameter used in api/v2/storage/thumbnails/ endpoint). In this example, we will use only 'recording_thumbnail' images. The complete list of supported parameters can be found at the bottom of this article.
poll_method - one of the common parameters which can be used for specific work of poller.
curl -X POST "https://web.skyvr.videoexpertsgroup.com/api/v3/channel_groups/" \
-H "accept: application/json" \
-H "Authorization: LKey {LKEY}" \
-H "Content-Type: application/json" \
-d "{
\"name\": \"example_token\",
\"max_channels_amount\": 11,
\"channels\": [ 11235 ],
\"include_all_channels\": false,
\"channels_access\": \"all\",
\"meta\": {
\"ai_engine\": \"aws\",
\"ai_type\": \"object_and_scene_detection\",
\"ai_period\": 180,
\"ai_params\": \"{
\\\"access_key\\\": \\\"{AWS_ACCESS_KEY}\\\",
\\\"secret_key\\\": \\\"{AWS_SECRET_KEY}\\\",
\\\"filter\\\": \\\"recording_thumbnail\\\",
\\\"poll_method\\\": \\\"one_token_many_cam\\\"
}\"
},
\"ai_targeted\": true
}"
The same request body in the swagger format:
{
"name": "example_token",
"max_channels_amount": 11,
"channels": [
11235
],
"include_all_channels": false,
"channels_access": "all",
"meta": {
"ai_engine": "aws",
"ai_type": "object_and_scene_detection",
"ai_period": 180,
"ai_params": "{ \"access_key\": \"{AWS_ACCESS_KEY}\", \"secret_key\": \"{AWS_SECRET_KEY}\", \"filter\": \"recording_thumbnail\", \"poll_method\": \"one_token_many_cam\" }"
},
"ai_targeted": true
}
Adding cameras to the existing group token
When the group token is created, you will see its id in the response. Also, you can always request the list of existing group tokens using api/v3/channel_groups/ endpoint. You should use the same endpoint to add more cameras to the group token. Let’s say you want to add one more camera with id=31415 to the group token with id=42 from the example above - then you need to list all channels including existing ones into the request:
curl -X PUT "https://web.skyvr.videoexpertsgroup.com/api/v3/channel_groups/42/" \
-H "accept: application/json" \
-H "Authorization: LKey {LKEY}" \
-H "Content-Type: application/json" \
-d "{
\"channels\": [ 11235, 31415 ]
}"
The list of common AI parameters:
filter - set to filter by one of the supported origins types. Used only with poll_method=one_token_many_cam (a process or task that caused the image creation):
undefined: the origin of the image is unknown (probably uploaded by the user or external service);
recording_thumbnail: an automatically generated during recording image;
generated_from_records: generated by an image generation task from storage records. IDs of the tasks of interest can be specified in the origin_id parameter;
generated_by_event: one of the automatically generated images by an event. IDs of the events of interest can be specified in the origin_id parameter;
generated_from_live: an image extracted in real-time from the live stream when the respective option (image_generation_period) is switched on.
min_threshold_of_people - Minimal threshold of people to send notifications.
max_threshold_of_people - Maximum threshold of people to send notifications.
min_threshold_of_cars - Minimal threshold of cars to send notifications.
max_threshold_of_cars - Maximum threshold of cars to send notifications.
poll_method - Method of image polling. There are two methods of polling:
one_token_many_cam: Takes one token and many cameras for polling requests to the VXG cloud.
one_cam_many_tokens: Takes one camera and many tokens for polling requests to the VXG cloud