CreateCommand

1. API Description

This API is used to create a command.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

name

Yes

String

Command name.

The length should be no more than 64 characters.

content

Yes

String

Script content.

The length should be no more than 4096 characters.

type

Yes

Script language type.

description

No

String

Command note.

The length should be no more than 255 characters.

resourceGroupId

No

String

Resource group ID.

tags

No

Bound tags when creating resources.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

commandId

String

Created command ID.

4. Code Example

Create a command in Shell language.

POST /api/v2/zos HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: CreateCommand
<Common Request Params>

Request:
{
  "name": "Test Command",
  "content": "echo 1",
  "type": "SHELL",
  "tags": {
    "tags": [
      {
        "key": "test",
        "value": "test"
      }
    ]
  }
}

Response:
{
  "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
  "response": {
    "requestId": "T05992D0C-7E8B-4047-B0C0-780F2CD549D3",
    "commandId": "<commandId>"
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

No error codes related to the API business logic. For other error codes, see Common Error Codes.​

Last updated