Queries the running details of commands.

Description

  • After you run a command, the command may not succeed or deliver the expected results. You can call this operation to query the actual execution results.
  • You can query the execution information that is generated within the last two weeks. Up to 100,000 lines of execution information can be retained.

Request parameter

Parameter Type Required Example Description
Action String Yes DescribeInvocations

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

RegionId String Yes cn-hangzhou

The region ID of the simple application server. You can call the ListRegions operation to query the most recent region list.

InstanceId String Yes 3a658ca270df4df39f22e289b338****

The ID of the simple application server.

PageNumber Integer No 1

The number of the page to return.

Pages start from page 1.

Default value: 1.

PageSize Integer No 10

The number of entries to return on each page.

Maximum value: 50.

Default value: 10

InvokeStatus String No Finished

The status of the command. Valid values:

  • Running: The command is running.
  • Finished: The command finishes running.
  • Failed: The command failed to be run.

Response parameters

Parameter Type Example Description
RequestId String 30637AD6-D977-4833-A54C-CC89483E****

The ID of the request.

Invocations Array of Invocation

Running records of commands.

CreationTime String 2022-07-11T06:37:16Z

The time when the command was created.

InvocationStatus String Success

The status of the command. Valid values:

  • Pending: The command is being verified or sent.
  • Invalid: The specified command type or parameter is invalid.
  • Aborted: The command failed to be sent. To send a command to an instance, make sure that the instance is in the Running state and the command is sent to the instance within 1 minute.
  • Running: The command is being run on the instance.
  • Success: The command finishes running, and the exit code is 0.
  • Failed: The command finishes running, but the exit code is not 0.
  • Error: The running of the command cannot proceed due to an exception.
  • Timeout: The running of the command times out.
  • Cancelled: The running is canceled, and the command is not run.
  • Stopping: The command that is running is being stopped.
  • Terminated: The command is terminated while it is being run.
CommandType String RunShellScript

The type of the command. Valid values:

  • RunBatScript: batch command (applicable to Windows instances).
  • RunPowerShellScript: PowerShell command (applicable to Windows instances).
  • RunShellScript: shell command (applicable to Linux instances).
CommandContent String bHM=

The content of the command, which is Base64-encoded.

Parameters Map

The custom parameters in the command. If no custom parameter exists in the command, the default value is {}.

InvokeStatus String Finished

The status of the command. Valid values:

  • Running: The command is running.
  • Finished: The command finishes running.
  • Failed: The running of the command failed.
  • Stopped: The running is stopped.
InvokeId String t-hz02p9545t6****

The ID of the command task.

CommandName String testname

The name of the command.

PageSize Integer 10

The number of entries returned per page.

PageNumber Integer 1

The page number of the returned page.

TotalCount Integer 10

The total number of commands.

Examples

Sample requests

http(s)://swas.cn-hangzhou.aliyuncs.com/?Action=DescribeInvocations
&RegionId=cn-hangzhou
&InstanceId=3a658ca270df4df39f22e289b338****
&PageNumber=1
&PageSize=10
&InvokeStatus=Finished
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeInvocationsResponse>
    <RequestId>30637AD6-D977-4833-A54C-CC89483E****</RequestId>
    <Invocations>
        <CreationTime>2022-07-11T06:37:16Z</CreationTime>
        <InvocationStatus>Success</InvocationStatus>
        <CommandType>RunShellScript</CommandType>
        <CommandContent>bHM=</CommandContent>
        <InvokeStatus>Finished</InvokeStatus>
        <InvokeId>t-hz02p9545t6****</InvokeId>
        <CommandName>testname</CommandName>
    </Invocations>
    <PageSize>10</PageSize>
    <PageNumber>1</PageNumber>
    <TotalCount>10</TotalCount>
</DescribeInvocationsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "30637AD6-D977-4833-A54C-CC89483E****",
  "Invocations" : [ {
    "CreationTime" : "2022-07-11T06:37:16Z",
    "InvocationStatus" : "Success",
    "CommandType" : "RunShellScript",
    "CommandContent" : "bHM=",
    "InvokeStatus" : "Finished",
    "InvokeId" : "t-hz02p9545t6****",
    "CommandName" : "testname"
  } ],
  "PageSize" : 10,
  "PageNumber" : 1,
  "TotalCount" : 10
}

Error codes

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