Skip to main content
Skip table of contents

Sub-user update

After the update, if there were changes in cameras, labels, layouts, groups, and permissions, a push notification will be sent with an array of IDs that were added or removed.

If access to certain cameras is revoked, the labels created for those cameras will be deleted, as well as the cameras from any created groups and layouts associated with this user.

When updating users, the parameters «cameras_to_attach» and «cameras_to_detach» should only be sent when there are changes, and only with the IDs of cameras that are currently being added or removed.

When adding or removing a large number of cameras, multiple requests will be required because each request can only include a maximum of 500 cameras.

PUT/api/v1/users/subusers/{subuser}

Headers

Authorization

Bearer token

Accept

application/json

X-Client

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

X-UUID

unique device id

Body

json

JSON
{
    "name": "User",
    "email": "user@mail.com",
    "analytic_l2": 1,
    "analytic_l3": 1,
    "cameras_to_attach": [
        752,
        758
    ],
    "cameras_to_detach": [
        487
    ],
    "layouts": [
        209
    ],
    "groups": [
        43
    ],
    "permissions": [
        15,
        13
    ],
    "marks": [
        19
    ]
}

subuseroptional

int

Identifier of the sub-user to update

namerequired

string

Sub-user name

emailrequired

string

Unique login (email) for the sub-user

analytic_l1required

int

Number of level-one analytics licenses the sub-user can create. This is mandatory only if there are permissions for this license level

analytic_l2required

int

Number of level-two analytics licenses the sub-user can create. This is mandatory only if there are permissions for this license level

analytic_l3required

int

Number of level-three analytics licenses the sub-user can create. This is mandatory only if there are permissions for this license level

cameras_to_attachrequired

array

Array of camera IDs to add to the sub-user. Maximum of 500 elements

cameras_to_detachrequired

array

Array of camera IDs to remove from the sub-user. Maximum of 500 elements

layoutsrequired

array

Array of layout IDs that will be accessible to the sub-user

groupsrequired

array

Array of group IDs that will be accessible to the sub-user. Access is granted to the group entity itself, not the cameras within the group. Access to individual cameras within the group needs to be granted separately

marksrequired

array

Array of label IDs that will be accessible to the sub-user. Note that this functionality is not available on the web, but the API supports it. Access to the label requires access to the associated camera

Response

200

Successful response

JSON
{
    "id": 44,
    "login": "user@mai.com",
    "name": "user@mai.com",
    "parent_id": 13,
    "permissions": [
        {
            "id": 22,
            "name": "camera-events-index",
            "display_name": "View camera events"
        },
        {
            "id": 240,
            "name": "analytic-cases-camera-obstacle",
            "display_name": "Business case - camera damage / overlap / vandalism detection"
        },
        {
            "id": 239,
            "name": "analytic-cases-line-intersection",
            "display_name": "Business case - line crossing detection"
        },
        {
            "id": 49,
            "name": "analytic-cases-index",
            "display_name": "List of business cases"
        }
    ],
    "cameras": [
        {
            "id": 765,
            "group_id": 100,
            "status": "active",
            "type": "media_server_v2",
            "start_at": "2022-04-06 12:13:58",
            "created_at": "2022-01-27 20:16:28",
            "billing_id": null,
            "pretty_name": "Camera 1",
            "lat": null,
            "lng": null,
            "azimuth": null,
            "is_archive_recording": true,
            "is_bridge": false,
            "is_favorite": false,
            "user_status": "active",
            "name": "Camera 1"
        },
        {
            "id": 761,
            "group_id": 100,
            "status": "active",
            "type": "media_server_v2",
            "start_at": "2022-04-06 12:13:58",
            "created_at": "2022-01-27 20:10:24",
            "billing_id": null,
            "pretty_name": "Camera 2",
            "lat": null,
            "lng": null,
            "azimuth": null,
            "is_archive_recording": true,
            "is_bridge": false,
            "is_favorite": false,
            "user_status": "active",
            "name": "Camera 2"
        }
    ],
    "groups": [
        {
            "id": 43,
            "name": "Group"
        }
    ],
    "layouts": [
        {
            "id": 209,
            "name": "01",
            "layout_template_id": 11,
            "layout_template": "Grid91",
            "user_id": 13,
            "grid": [
                null,
                {
                    "id": 753,
                    "group_id": 101,
                    "status": "active",
                    "type": "media_server_v2",
                    "start_at": "2022-04-06 12:13:58",
                    "created_at": "2022-01-27 19:48:31",
                    "billing_id": null,
                    "pretty_name": "Camera 3",
                    "pretty_text": "Cameras",
                    "short_address": "Cameras",
                    "full_address": "Cameras",
                    "lat": null,
                    "lng": null,
                    "azimuth": null,
                    "streams": [
                        {
                            "id": 748,
                            "type": "high",
                            "camera_id": 753,
                            "is_preview_from_server": true,
                            "is_archive_from_server": null,
                            "status": "active",
                            "has_sound": false,
                            "layout_priority": "reserve",
                            "width": 2048,
                            "height": 1536
                        },
                        {
                            "id": 749,
                            "type": "low",
                            "camera_id": 753,
                            "is_preview_from_server": true,
                            "is_archive_from_server": null,
                            "status": "active",
                            "has_sound": false,
                            "layout_priority": "main",
                            "width": 2048,
                            "height": 1536
                        }
                    ],
                    "services": {
                        "ptz": false,
                        "motion_detect": false
                    },
                    "has_sound": false,
                    "is_archive_recording": true,
                    "is_bridge": false,
                    "is_favorite": false,
                    "user_status": "active",
                    "name": "Camera 3"
                },
                null,
                {
                    "id": 765,
                    "group_id": 100,
                    "status": "active",
                    "type": "media_server_v2",
                    "start_at": "2022-04-06 12:13:58",
                    "created_at": "2022-01-27 20:16:28",
                    "billing_id": null,
                    "pretty_name": "Camera 1",
                    "pretty_text": "Cameras",
                    "short_address": "Cameras",
                    "full_address": "Cameras",
                    "lat": null,
                    "lng": null,
                    "azimuth": null,
                    "streams": [
                        {
                            "id": 772,
                            "type": "high",
                            "camera_id": 765,
                            "is_preview_from_server": true,
                            "is_archive_from_server": null,
                            "status": "active",
                            "has_sound": false,
                            "layout_priority": "reserve",
                            "width": 1920,
                            "height": 1080
                        },
                        {
                            "id": 773,
                            "type": "low",
                            "camera_id": 765,
                            "is_preview_from_server": true,
                            "is_archive_from_server": null,
                            "status": "active",
                            "has_sound": false,
                            "layout_priority": "main",
                            "width": 704,
                            "height": 576
                        }
                    ],
                    "services": {
                        "ptz": false,
                        "motion_detect": false
                    },
                    "has_sound": false,
                    "is_archive_recording": true,
                    "is_bridge": false,
                    "is_favorite": false,
                    "user_status": "active",
                    "name": "Camera 1"
                },
                null,
                null,
                null
            ],
            "created_at": "2021-09-15 18:50:19",
            "updated_at": "2022-02-08 09:41:30"
        }
    ],
    "marks": [
        {
            "id": 485887,
            "type": "mark",
            "type_pretty": "Mark",
            "title": "New mark",
            "can_delete": true,
            "from": "2022-02-18 07:43:40",
            "to": null,
            "camera_id": 752,
            "created_at": "2022-02-18 16:43:07",
            "updated_at": "2022-02-18 16:43:07"
        }
    ],
    "created_at": "2021-11-24 23:52:20",
    "updated_at": "2021-12-09 18:44:38",
    "access_token_id": null,
    "can_update_password": false,
    "analytic_license": [
        {
            "type": "analytic_l1",
            "type_pretty": "LIC-XXXX-YY-L1",
            "all": 1,
            "free": 1,
            "used": 0
        },
        {
            "type": "analytic_l2",
            "type_pretty": "LIC-XXXX-YY-L2",
            "all": 1,
            "free": 1,
            "used": 0
        },
        {
            "type": "analytic_l3",
            "type_pretty": "LIC-XXXX-YY-L3",
            "all": 1,
            "free": 1,
            "used": 0
        }
    ]
}
404

If the sub-user does not belong to the user or does not exist

401

Authorization token not provided or invalid, see Obtaining a token

Example

JSON
curl -k --location --request PUT 'https://vms.local/api/v1/users/subusers/{subuser}' \
--header 'Authorization:Bearer token' \
--header 'Accept:application/json' \
--header 'X-Client:ios-cctv|android-cctv|thick-legal|web' \
--header 'X-UUID:unique device id' \
--header 'Content-Type: application/json \
--data-raw '{
    "name": "User",
    "email": "user@mail.com",
    "analytic_l2": 1,
    "analytic_l3": 1,
    "cameras_to_attach": [
        752,
        758
    ],
    "cameras_to_detach": [
        487
    ],
    "layouts": [
        209
    ],
    "groups": [
        43
    ],
    "permissions": [
        15,
        13
    ],
    "marks": [
        19
    ]
}'
JavaScript errors detected

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

If this problem persists, please contact our support.