Get а camera treе
Get a camera tree
The logic of building the tree is divided into 2 possible scenarios depending on the configured env
variable TREE_CAMERA_SINGLE_REQUEST_MAX_CAMERAS_COUNT
.
When the number of a user's cameras is greater than the value specified in the env
variable TREE_CAMERA_SINGLE_REQUEST_MAX_CAMERAS_COUNT
, then the tree will be constructed according to the following principle:
This query returns a list of groups at the <i>N</i>th level of nesting. To get the groups at the next level of nesting, you need to repeat the same query, additionally specifying the group_id
parameter of the parent group.
In this scenario, the children
parameter is not taken into account; it is always null
.
Using the has_items
parameter, we can determine whether a group contains cameras. If the parameter has_items= to true
, it means that the group in question contains cameras and there is no need to query for child groups.
When the number of a user's cameras is less than the value specified in the env
variable TREE_CAMERA_SINGLE_REQUEST_MAX_CAMERAS_COUNT
, then the tree will return with a single query.
If the children
parameter is empty and there are no elements in it, it means that the group is a leaf node.
If a user has bridges with cameras, a Devices folder will be created, containing subfolders for each bridge. These subfolders are terminal points, requiring a separate query to retrieve their cameras (see below).
If a user has cameras with an agent installed, a Cameras folder will be added inside the Devices folder. This group is considered a leaf node, and to retrieve information about the cameras within it, a separate query (described below) must be made.
In both cases, to obtain a list of cameras from a final group, you must use a request for a list of cameras in the group, specifying the group_id
parameter and the search
parameter, in case if a search was previously carried out in the camera tree
[VMS Client/Cameras/Common queries/List of cameras in the client group]
GET /api/v2/cameras/tree |
Parameters
string search
– search by address and camera name.
int group_id
– an ID of a parent group.
200 |
Returns a JSON tree object of the same nesting level
JSON
|
200 |
JSON
|
401 |
The Authorization token not sent or invalid |
422 |
Returns a JSON object with an error.
JSON
|