Updated on 2022-02-22 GMT+08:00

Creating a Screen

Function

Create a screen. The screen content comes from a screen template.

URI

  • URI format
    POST /v1/{project_id}/screens
  • Parameter description
    Table 1 URI parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Request

Table 2 describes the request parameters.
Table 2 Request parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Name of the screen. The value contains 1 to 32 characters and consists of digits and letters.

alias

No

String

Alias of the screen. The value contains 1 to 255 characters. The default value is empty.

description

No

String

Description of the screen. The value is 0 to 512 characters. The default value is empty.

templateId

Yes

String

Template ID of the screen. For details about how to obtain the template ID, see Obtaining a Template List.

workspaceId

Yes

String

Workspace ID, which consists of 32 characters. For details about how to obtain the workspace ID, see Obtaining a Workspace ID.

Response

Table 3 describes the response parameters.
Table 3 Response parameters

Parameter

Type

Description

id

String

ID of the screen.

name

String

Name of the screen.

alias

String

Alias of the screen.

description

String

Description of the screen.

status

Integer

Status of the screen: 0-created, 1-deleted, 2-shared

projectId

String

ID of the project.

createUser

String

Creator of the screen.

createDate

Integer

Timestamp for creating the screen.

updateUser

String

User who updates the screen.

updateDate

Integer

Timestamp for updating the screen.

templateId

String

Template ID used when creating the screen.

snapshotId

String

ID of the screen snapshot.

share

String

UUID for sharing the screen.

thumbnail

String

URL for accessing the screen thumbnail.

config

config object

Configuration content of the screen.

Table 4 config data structure

Parameter

Type

Description

scenes

Array of scene objects

Scene information.

config

Array of config objects

Configuration details.

Table 5 scene

Parameter

Type

Description

name

String

Name of the scene.

layers

Array of layer objects

Layers of the scene.

Table 6 layer

Parameter

Type

Description

id

String

ID of the layer.

name

String

Name of the layer.

coms

Array

Component list.

Table 7 config

Parameter

Type

Description

id

String

Unique ID of the screen.

screenId

String

ID of the screen.

grid

Integer

Grid spacing in units of pixels.

backgroundImage

String

OBS link of the background image.

backgroundColor

String

Color of the background.

width

Integer

Screen width in units of pixels.

height

Integer

Screen height in units of pixels.

whLinkage

Integer

Association of width and height. 0: Disable; 1: Enable

comList

String

Component list.

screenshot

String

Cover image.

display

Integer

Zoom modes:

  • 1. Uniform scaling with width
  • 2. Uniform scaling with height
  • 3. Uniform adaptive scaling
  • 4: Full screen stretch

watermarkFlag

Integer

Specifies whether a watermark is available.

rulerLines

rulerLines object

Coordinate.

variables

variables object

Interaction information.

workspaceId

String

Workspace ID.

Table 8 rulerLines

Parameter

Type

Description

h

String

Horizontal ruler line coordinate in units of pixels.

v

String

Vertical ruler line coordinate in units of pixels.

show

Boolean

Specifies whether to display ruler lines. The options are true (yes) and false (no).

Table 9 variables

Parameter

Type

Description

publishersView

String

Interaction parameters of the sending component.

subscribersView

String

Interaction parameters of the receiving component.

Examples

Create screen_01. The template ID is 32546212564.

  • Request example
    POST https://{dlv_endpoint}/v1/{project_id}/screens
    Request header
    
    {
        "name":"screen_01",
        "alias":"test_screen_01",
        "description":"for test",
        "templateId":"32546212564",
        "workspaceId":"86ce107974ce4f93b618acb232863027"
    }
  • Example of a successful response
    {
        "id": "ff80808167813a360167819d5b640045",
        "name": "screen_01",
        "alias": "test_screen_01",
        "description": "for test",
        "status": 0,
        "projectId": "abcdefghijk0123456",
        "createUser": "a1b2c2d3e4f5g6h5j6k6",
        "createDate": 1544067832676,
        "updateUser": null,
        "updateDate": null,
        "templateId": "2a8281f9678bb29f01678bb9b2d60001",
        "snapshotId": null,
        "share": null,
        "thumbnail": null,
        "config": {
            "scenes": [
                {
    "name": "scenario 1",
                    "layers": [
                        {
                            "id": null,
    "name": "layer 1",
                            "coms": []
                        }
                     ]
                }
            ],
            "config": {
                "id": null,
                "screenId": "ff80808167813a360167819d5b640045",
                "grid": null,
                "backgroundImage": "",
                "backgroundColor": null,
                "width": 1920,
                "height": 1080,
                "whLinkage": null,
                "comList": "",
                "screenshot": null,
                "display": 1,
                "watermarkFlag": null,
                "rulerLines": null,
                "variables": null
            }
        }
    }
  • Example of a failed response
    {
        "errors": [
            {
                "error_code": "DLV.1011",
                "error_msg": "Invalid template id."
            }
        ]
    }

Status Codes

For details about status codes, see Status Codes.