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

Getting Started

This section describes the procedure for creating a screen by calling APIs:

1. If the token authentication is used, obtain the user token. The token will be put into the request header for authentication in a subsequent request.

2. Call an API to create a screen.

Prerequisite

Procedure

The following values are examples (replace them with actual values):

  • IAM endpoint: iam_endpoint
  • DLV endpoint: dlv_endpoint
  • Project ID: project_id

Perform the following operations to create a screen:

  1. When using token authentication, obtain the user token and set it as an environment variable.

    curl -H "Content-Type:application/json" https://iam_endpoint/v3/auth/tokens -X POST -d '{ 
        "auth": { 
            "identity": { 
                "methods": [ 
                    "password" 
                ], 
                "password": { 
                    "user": { 
                        "name": "testname", 
                        "domain": { 
                            "name": "testname" 
                        }, 
                        "password": "Passw0rd" 
                    } 
                } 
            }, 
            "scope": { 
                "project": { 
                    "name": "ap-southeast-1"
                } 
            } 
        } 
    }' -v -k

    The value of X-Subject-Token in the response header is the token.

    X-Subject-Token:MIIDkgYJKoZIhvcNAQcCoIIDgzCCA38CAQExDTALBglghkgBZQMEAgEwgXXXXX...

    Run the following command to set the token as an environment variable for future use: The value of X-Auth-Token is the token value obtained in the previous step.

    export Token=MIIDkgYJKoZIhvcNAQcCoIIDgzCCA38CAQExDTALBglghkgBZQMEAgEwgXXXXX...

  2. Call the API for creating a screen.

    curl -X POST -H 'Content-Type:application/json;charset=utf-8' -H "X-Auth-Token:$Token" -d '{ 
        "name": "my_screen", 
        "alias": "first_screen", 
        "description": "my first screen", 
        "template_id": "453113551",
        "workspaceId":"86ce107974ce4f93b618acb232863027"
        } 
    }' https://dlv_endpoint/v1/project_id/screens -v -k

    Screen parameters are described as follows:

    • name: name of the screen.
    • alias: alias of the screen.
    • description: description of the screen.
    • template_id: ID of the screen template.
    • workspaceId: workspace ID.

    If status code 200 is returned, the screen is successfully created. If a status code listed Status Codes is returned, the screen fails to be created.