Skip to main content
Skip table of contents

Get a cаmera flat trеe

Get a camera flat tree

The has_cameras parameter can be used to determine whether a group contains cameras.

If a user has bridges with cameras, the user will see individual folders for each bridge. The name of this folder will be as the bridge name. To access the cameras within a bridge, a separate request is required.
The id filed of groups can be int and string.

To retrieve a list of cameras from a leaf node, a group camera list query must be executed. The query should include group_id and any relevant search parameters if earlier a search was applied in the camera tree ad in VMS Client/Cameras/Common queries/List of cameras in the client group.

GET /api/v2/cameras/flat-tree

Parameters

string search – search by address and camera name.

int page – a page number in pagination.

int per_page – a number of elements per pagination page. By default, 10 elements.

200 OK

Returns a JSON tree object of the same nesting level

JSON
{
    "data": [
        {
            "id": -54,
            "name": "name",
            "cameras": [
                {
                    "id": 7631,
                    "is_bridge": true,
                    "status": "active",
                    "preview": "https://localhost:80/live/bc0d209e-8449-4c92-8c34-9e12660b8599/preview.mp4?token=sUuW0DWC4pYZJFzJh",
                    "user_status": "active",
                    "is_favorite": false,
                    "is_restricted_live": false,
                    "name": "intercom 3"
                }
            ],
            "full_address": "name"
        },
        {
            "id": -55,
            "name": "name",
            "cameras": [
                {
                    "id": 7632,
                    "is_bridge": true,
                    "status": "active",
                    "preview": "https://localhost:80/live/bc0d209e-8449-4c92-8c34-9e12660b8599/preview.mp4?token=sUuW0DWC4pYZJFzJh",
                    "user_status": "active",
                    "is_favorite": false,
                    "is_restricted_live": false,
                    "name": "intercom 3"
                }
            ],
            "full_address": "name"
        },
        {
            "id": 8,
            "name": "Test cameras, intercoms",
            "cameras": [
                {
                    "id": 7680,
                    "is_bridge": false,
                    "status": "active",
                    "preview": "https://localhost:80/live/bc0d209e-8449-4c92-8c34-9e12660b8599/preview.mp4?token=sUuW0DWC4pYZJFzJh-b",
                    "user_status": "active",
                    "is_favorite": false,
                    "is_restricted_live": false,
                    "name": "issue_cam"
                }
            ],
            "full_address": "Test cameras, intercoms"
        }
    ],
    "links": {
        "first": "http://localhost:80/api/v2/cameras/flat-tree?per_page=3&page=1",
        "last": "http://localhost:80/api/v2/cameras/flat-tree?per_page=3&page=3",
        "prev": "http://localhost:80/api/v2/cameras/flat-tree?per_page=3&page=1",
        "next": "http://localhost:80/api/v2/cameras/flat-tree?per_page=3&page=3"
    },
    "meta": {
        "current_page": 2,
        "from": 4,
        "last_page": 3,
        "links": [
            {
                "url": "http://localhost:80/api/v2/cameras/flat-tree?per_page=3&page=1",
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://localhost:80/api/v2/cameras/flat-tree?per_page=3&page=1",
                "label": "1",
                "active": false
            },
            {
                "url": "http://localhost:80/api/v2/cameras/flat-tree?per_page=3&page=2",
                "label": "2",
                "active": true
            },
            {
                "url": "http://localhost:80/api/v2/cameras/flat-tree?per_page=3&page=3",
                "label": "3",
                "active": false
            },
            {
                "url": "http://localhost:80/api/v2/cameras/flat-tree?per_page=3&page=3",
                "label": "Next »",
                "active": false
            }
        ],
        "path": "http://localhost:80/api/v2/cameras/flat-tree",
        "per_page": 3,
        "to": 6,
        "total": 9
    }
}

401 Unauthorized

The Authorization token isn’t sent or invalid.

422 Unprocessable Entity

Returns a JSON object with an error.

JSON
{
    "message": "There will be no informative message here",
    "errors": {
        "any_key": [
            "The cause of the error will be described here"
        ]
    }
}
cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/v2/cameras/flat-tree' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "search": "string",
    "page": 0,
    "per_page": 0
}'
PHP
PHP
$data = array (
  'search' => 'string',
  'page' => 0,
  'per_page' => 0,
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'GET',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/v2/cameras/flat-tree', false, $context);
JavaScript errors detected

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

If this problem persists, please contact our support.