Skip to main content
Skip table of contents

Получение дерева камер. VMS Client API

Возвращает дерево камер с объектами камер. Для каждого запроса добавляет паку «Все камеры», в которой будут лежать все собранные камеры пользователя в одной папке

GET/api/v1/users/tree

Headers

Authorization

Bearer token

Accept

application/json

X-Client

ios-cctv|android-cctv|thick-legal|web

X-UUID

unique device id

Body

searchrequired

string

Поиск по адресу и имени камеры

excluderequired

array

Массив id камер, которые нужно исключить из ответа

hide_allrequired

bool

Если нет search и exclude и прислать true, то в респонсе не будет папки «Все камеры»

Response

200

Возвращает JSON объект дерева

JSON
[
    {
        "id": 0,
        "name": "Все камеры",
        "children": [],
        "cameras": [
            {
                "id": 787,
                "group_id": 100,
                "status": "active",
                "type": "media_server_v2",
                "start_at": "2022-02-15 15:14:06",
                "created_at": "2022-02-03 10:30:28",
                "billing_id": null,
                "pretty_name": "Камера 1",
                "pretty_text": "Камеры",
                "short_address": "Камеры",
                "full_address": "Камеры",
                "lat": null,
                "lng": null,
                "azimuth": null,
                "streams": [
                    {
                        "id": 813,
                        "type": "high",
                        "camera_id": 787,
                        "is_preview_from_server": true,
                        "is_archive_from_server": null,
                        "status": "active",
                        "has_sound": false
                    },
                    {
                        "id": 814,
                        "type": "low",
                        "camera_id": 787,
                        "is_preview_from_server": true,
                        "is_archive_from_server": null,
                        "status": "active",
                        "has_sound": false
                    }
                ],
                "services": {
                    "ptz": false,
                    "motion_detect": false
                },
                "has_sound": false,
                "is_archive_recording": true,
                "is_bridge": false,
                "is_favorite": false,
                "is_owner": true,
                "can_change_archive_timetable": true,
                "archive_recording_type": "timetable",
                "user_status": "active",
                "name": "Камера 1"
            },
            {
                "id": 763,
                "group_id": 100,
                "status": "inactive",
                "type": "media_server_v2",
                "start_at": "",
                "created_at": "2022-01-27 20:13:33",
                "billing_id": null,
                "pretty_name": "Камера 2",
                "pretty_text": "Камеры",
                "short_address": "Камеры",
                "full_address": "Камеры",
                "lat": null,
                "lng": null,
                "azimuth": null,
                "streams": [
                    {
                        "id": 768,
                        "type": "high",
                        "camera_id": 763,
                        "is_preview_from_server": true,
                        "is_archive_from_server": null,
                        "status": "inactive",
                        "has_sound": false
                    },
                    {
                        "id": 769,
                        "type": "low",
                        "camera_id": 763,
                        "is_preview_from_server": true,
                        "is_archive_from_server": null,
                        "status": "inactive",
                        "has_sound": false
                    }
                ],
                "services": {
                    "ptz": false,
                    "motion_detect": false
                },
                "has_sound": false,
                "is_archive_recording": true,
                "is_bridge": false,
                "is_favorite": false,
                "is_owner": true,
                "can_change_archive_timetable": true,
                "archive_recording_type": "timetable",
                "user_status": "active",
                "name": "Камера 2"
            }
        ],
        "has_cameras": true
    },
    {
        "id": 97,
        "name": "Все камеры 2",
        "children": [
            {
                "id": 98,
                "name": "Камеры 2",
                "children": [],
                "cameras": [
                    {
                        "id": 748,
                        "group_id": 98,
                        "status": "partial",
                        "type": "media_server_v2",
                        "start_at": "2022-02-02 11:58:07",
                        "created_at": "2022-01-27 19:13:57",
                        "billing_id": null,
                        "pretty_name": "Камера 3",
                        "pretty_text": "Камеры 2",
                        "short_address": "Камеры 2",
                        "full_address": "Камеры 2",
                        "lat": null,
                        "lng": null,
                        "azimuth": null,
                        "streams": [
                            {
                                "id": 739,
                                "type": "high",
                                "camera_id": 748,
                                "is_preview_from_server": true,
                                "is_archive_from_server": null,
                                "status": "inactive",
                                "has_sound": false
                            }
                        ],
                        "services": {
                            "ptz": false,
                            "motion_detect": false
                        },
                        "has_sound": false,
                        "is_archive_recording": true,
                        "is_bridge": false,
                        "is_favorite": false,
                        "is_owner": true,
                        "can_change_archive_timetable": true,
                        "archive_recording_type": "timetable",
                        "user_status": "active",
                        "name": "Камера 3"
                    },
                    {
                        "id": 745,
                        "group_id": 98,
                        "status": "active",
                        "type": "media_server_v2",
                        "start_at": "2022-02-02 11:58:07",
                        "created_at": "2022-01-27 18:55:48",
                        "billing_id": null,
                        "pretty_name": "Камера 4",
                        "pretty_text": "Камеры 2",
                        "short_address": "Камеры 2",
                        "full_address": "Камеры 2",
                        "lat": null,
                        "lng": null,
                        "azimuth": null,
                        "streams": [
                            {
                                "id": 733,
                                "type": "high",
                                "camera_id": 745,
                                "is_preview_from_server": true,
                                "is_archive_from_server": null,
                                "status": "active",
                                "has_sound": false
                            },
                            {
                                "id": 734,
                                "type": "low",
                                "camera_id": 745,
                                "is_preview_from_server": true,
                                "is_archive_from_server": null,
                                "status": "active",
                                "has_sound": false
                            }
                        ],
                        "services": {
                            "ptz": false,
                            "motion_detect": false
                        },
                        "has_sound": false,
                        "is_archive_recording": true,
                        "is_bridge": false,
                        "is_favorite": false,
                        "is_owner": true,
                        "can_change_archive_timetable": true,
                        "archive_recording_type": "timetable",
                        "user_status": "active",
                        "name": "Камера 4"
                    }
                ],
                "has_cameras": true
            },
            {
                "id": 101,
                "name": "Камеры 3",
                "children": [],
                "cameras": [
                    {
                        "id": 751,
                        "group_id": 101,
                        "status": "active",
                        "type": "media_server_v2",
                        "start_at": "2022-02-02 11:58:07",
                        "created_at": "2022-01-27 19:46:27",
                        "billing_id": null,
                        "pretty_name": "Камера 5",
                        "pretty_text": "Камеры 3",
                        "short_address": "Камеры 3",
                        "full_address": "Камеры 3",
                        "lat": null,
                        "lng": null,
                        "azimuth": null,
                        "streams": [
                            {
                                "id": 744,
                                "type": "high",
                                "camera_id": 751,
                                "is_preview_from_server": true,
                                "is_archive_from_server": null,
                                "status": "active",
                                "has_sound": false
                            },
                            {
                                "id": 745,
                                "type": "low",
                                "camera_id": 751,
                                "is_preview_from_server": true,
                                "is_archive_from_server": null,
                                "status": "active",
                                "has_sound": false
                            }
                        ],
                        "services": {
                            "ptz": false,
                            "motion_detect": false
                        },
                        "has_sound": false,
                        "is_archive_recording": true,
                        "is_bridge": false,
                        "is_favorite": false,
                        "is_owner": true,
                        "can_change_archive_timetable": true,
                        "archive_recording_type": "timetable",
                        "user_status": "active",
                        "name": "Камера 5"
                    },
                    {
                        "id": 759,
                        "group_id": 101,
                        "status": "active",
                        "type": "media_server_v2",
                        "start_at": "2022-02-02 11:58:07",
                        "created_at": "2022-01-27 19:55:17",
                        "billing_id": null,
                        "pretty_name": "Камера 6",
                        "pretty_text": "Камеры 3",
                        "short_address": "Камеры 3",
                        "full_address": "Камеры 3",
                        "lat": null,
                        "lng": null,
                        "azimuth": null,
                        "streams": [
                            {
                                "id": 760,
                                "type": "high",
                                "camera_id": 759,
                                "is_preview_from_server": true,
                                "is_archive_from_server": null,
                                "status": "active",
                                "has_sound": false
                            },
                            {
                                "id": 761,
                                "type": "low",
                                "camera_id": 759,
                                "is_preview_from_server": true,
                                "is_archive_from_server": null,
                                "status": "active",
                                "has_sound": false
                            }
                        ],
                        "services": {
                            "ptz": false,
                            "motion_detect": false
                        },
                        "has_sound": false,
                        "is_archive_recording": true,
                        "is_bridge": false,
                        "is_favorite": false,
                        "is_owner": true,
                        "can_change_archive_timetable": true,
                        "archive_recording_type": "timetable",
                        "user_status": "active",
                        "name": "Камера 6"
                    }
                ],
                "has_cameras": true
            }
        ],
        "cameras": [],
        "has_cameras": false
    }
]
401

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

422

Возвращает JSON объект с ошибкой, см. Валидация

JSON
{
    "message": "Тут не будет информативного сообщения",
    "errors": {
        "any_key": [
            "Тут будет описана причина ошибки"
        ]
    }
}

Пример

JSON
curl -k --location --request GET 'https://vms.local/api/v1/users/tree?search=string&exclude=array&hide_all=bool' \
--header 'Authorization:Bearer token' \
--header 'Accept:application/json' \
--header 'X-Client:ios-cctv|android-cctv|thick-legal|web' \
--header 'X-UUID:unique device id'
JavaScript errors detected

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

If this problem persists, please contact our support.