You can call this operation to query the Cloud Assistant commands that you have created. If you only specify the Action and RegionId parameters, the system queries all available commands by default.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeCommands

The operation that you want to perform. Set the value to DescribeCommands.

RegionId String Yes cn-hangzhou

The region ID of the query. You can call the DescribeRegions operation to query the most recent region list.

CommandId String No c-7d2a745b412b4601b2d47f6a768d3***

The ID of the command.

Name String No Test1

The name of the command. Partial command names are not supported.

Description String No test

The description of the command.

Type String No RunShellScript

The type of the command. Valid values:

  • RunBatScript: a batch command for Windows instances.
  • RunPowerShellScript: a PowerShell command for Windows instances.
  • RunShellScript: a Shell command for Linux instances.
ContentEncoding String No PlainText

Specifies the encoding method of the fields CommandContent and Output in the response parameters. Valid values:

  • PlainText: returns the original command content and command output.
  • Base64: returns Base64-encoded command content and command output.

Default value: Base64.

PageNumber Long No 1

The number of the page to return. Pages start from page 1.

Default value: 1

PageSize Long No 10

The number of entries to return on each page. Maximum value: 50.

Default value: 10.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

TotalCount Long 5

The total number of commands.

PageNumber Long 1

The page number of the command list.

PageSize Long 10

The number of entries returned per page.

Commands Array

An array consisting of the command data.

CommandId String c-7d2a745b412b4601b2d47f6a768d3***

The ID of the command.

Name String Test1

The name of the command.

Type String RunShellScript

The type of the command.

Description String test

The description of the command.

CommandContent String Y2QgL3Jvb3Q=

The Base64-encoded command content.

WorkingDir String /home/

The directory path for command invocation.

Timeout Long 3600

The timeout period.

CreationTime String 2018-01-05T15:45:02Z

The time when the command was created.

EnableParameter Boolean true

Indicates whether the custom parameter feature was enabled for the command.

ParameterNames List ['parameter1','parameter2']

A List of custom parameter names which are parsed from the command content at the command creation. The values of this parameter are returned in the list form. If the custom parameter feature is not enabled, an empty list is returned.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DescribeCommands
&RegionId=cn-hangzhou
&CommandId=c-7d2a745b412b4601b2d47f6a768d3***
&PageNumber=1
&PageSize=10
&<Common request parameters>

Sample success responses

XML format

<TotalCount>5</TotalCount>
<Commands>
    <Command>
        <Name>Test</Name>
        <WorkingDir/>
        <CommandContent>ZWNobyAxMjM=</CommandContent>
        <Timeout>3600</Timeout>
        <Type>RunShellScript</Type>
        <CommandId>c-7d2a745b412b4601b2d47f6a768d3***</CommandId>
        <Description>test</Description>
        <EnableParameter>false</EnableParameter>
    </Command>
    <Command>
        <Name>Test1</Name>
        <WorkingDir/>
        <CommandContent>Y2QgL3Jvb3Q=</CommandContent>
        <Timeout>3600</Timeout>
        <Type>RunShellScript</Type>
        <CommandId>c-7d2a745b412b4601b2d47f6a768d3***</CommandId>
        <Description>test1</Description>
        <EnableParameter>false</EnableParameter>
    </Command>
    <Command>
        <Name>Test2</Name>
        <WorkingDir/>
        <CommandContent>eXVtIHVwZGF0ZQ==</CommandContent>
        <Timeout>3600</Timeout>
        <Type>RunShellScript</Type>
        <CommandId>c-7d2a745b412b4601b2d47f6a768d3***</CommandId>
        <Description>test2</Description>
    </Command>
    <Command>
        <Name>Test3</Name>
        <WorkingDir/>
        <CommandContent>c2VydmljZSBuZ2lueCByZWxvYWQ=</CommandContent>
        <Timeout>3600</Timeout>
        <Type>RunShellScript</Type>
        <CommandId>c-7d2a745b412b4601b2d47f6a768d3***</CommandId>
        <Description>test3</Description>
        <EnableParameter>false</EnableParameter>
    </Command>
    <Command>
        <Name>Test4</Name>
        <WorkingDir/>
        <CommandContent>ZWNobyB7e25hbWV9fSA=</CommandContent>
        <Timeout>3600</Timeout>
        <Type>RunShellScript</Type>
        <CommandId>c-7d2a745b412b4601b2d47f6a768d3***</CommandId>
        <Description>test4</Description>
        <EnableParameter>true</EnableParameter>
        <ParameterNames>name</ParameterNames>
    </Command>
</Commands>
<PageNumber>1</PageNumber>
<RequestId>E69EF3CC-94CD-42E7-8926-F133B86387C0</RequestId>
<PageSize>10</PageSize>

JSON format

{
    "TotalCount": 5,
    "Commands": {
        "Command": [
            {
                "Name": "Test",
                "WorkingDir": "",
                "CommandContent": "ZWNobyAxMjM=",
                "Timeout": 3600,
                "Type": "RunShellScript",
                "CommandId": "c-7d2a745b412b4601b2d47f6a768d3***",
                "Description": "test",
                "EnableParameter": false,
                "ParameterNames": []
            },
            {
                "Name": "Test1",
                "WorkingDir": "",
                "CommandContent": "Y2QgL3Jvb3Q=",
                "Timeout": 3600,
                "Type": "RunShellScript",
                "CommandId": "c-7d2a745b412b4601b2d47f6a768d3***",
                "Description": "test1",
                "EnableParameter": false,
                "ParameterNames": []
            },
            {
                "Name": "Test2",
                "WorkingDir": "",
                "CommandContent": "eXVtIHVwZGF0ZQ==",
                "Timeout": 3600,
                "Type": "RunShellScript",
                "CommandId": "c-7d2a745b412b4601b2d47f6a768d3***",
                "Description": "test2"
            },
            {
                "Name": "Test3",
                "WorkingDir": "",
                "CommandContent": "c2VydmljZSBuZ2lueCByZWxvYWQ=",
                "Timeout": 3600,
                "Type": "RunShellScript",
                "CommandId": "c-7d2a745b412b4601b2d47f6a768d3***",
                "Description": "test3",
                "EnableParameter": false,
                "ParameterNames": []
            },
            {
                "Name": "Test4",
                "WorkingDir": "",
                "CommandContent": "ZWNobyB7e25hbWV9fSA=",
                "Timeout": 3600,
                "Type": "RunShellScript",
                "CommandId": "c-7d2a745b412b4601b2d47f6a768d3***",
                "Description": "test4",
                "EnableParameter": true,
                "ParameterNames": [
                    "name"
                ]
            }
        ]
    },
    "PageNumber": 1,
    "RequestId": "E69EF3CC-94CD-42E7-8926-F133B86387C0",
    "PageSize": 10
}

Error codes

HTTP status code Error code Error message Description
500 InternalError.Dispatch An error occurred when you dispatched the request. The error message returned because an unknown error has occurred.
403 InvalidParam.PageNumber The specified parameter is invalid. The error message returned because the specified PageNumber parameter is invalid.
403 InvalidParam.PageSize The specified parameter is invalid. The error message returned because the specified PageSize parameter is invalid.

For a list of error codes, visit the API Error Center.