Skip to main content
Skip table of contents

Creating a layout

Creating a layout. Empty layouts without cameras can be created

POST/api/v1/layouts

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": "new name",
    "layout_template": "Grid51",
    "grid": [
        {
            "camera_id": 12,
            "stream_id": 15
        },
        null,
        {
            "camera_id": 15,
            "stream_id": 19
        }
    ]
}

namerequired

string

Layout name, it must be unique for the user

layout_templaterequired

string

Unique identifier of the layout template. The list can be found in Main configurations

gridrequired

string

Array of objects for each layout cell. If a cell is left empty, send null instead of an object

Response

200

Successful response

JSON
{
    "id": 219,
    "name": "1",
    "layout_template_id": 1,
    "layout_template": "Grid11",
    "user_id": 5,
    "grid": [
        {
            "id": 751,
            "group_id": 101,
            "status": "active",
            "type": "media_server_v2",
            "start_at": "2022-03-03 17:50:52",
            "created_at": "2022-01-27 19:46:27",
            "billing_id": null,
            "pretty_name": "Camera",
            "pretty_text": "Cameras",
            "short_address": "Cameras",
            "full_address": "Cameras",
            "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,
                    "layout_priority": "reserve",
                    "width": 2048,
                    "height": 1536
                },
                {
                    "id": 745,
                    "type": "low",
                    "camera_id": 751,
                    "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"
        }
    ],
    "created_at": "2021-10-04 13:57:56",
    "updated_at": "2021-10-04 13:57:56"
}
401

Authorization token not provided or invalid, see Obtaining a token

422

Returns a JSON object with an error, see Validation

JSON
{
    "message": "There won't be any informative message here",
    "errors": {
        "any_key": [
            "Here the error cause will be described"
        ]
    }
}

Example

JSON
curl -k --location --request POST 'https://vms.local/api/v1/layouts' \
--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": "new name",
    "layout_template": "Grid51",
    "grid": [
        {
            "camera_id": 12,
            "stream_id": 15
        },
        null,
        {
            "camera_id": 15,
            "stream_id": 19
        }
    ]
}'
JavaScript errors detected

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

If this problem persists, please contact our support.