- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
GetCommandExecutionCommand
Gets information about the specific command execution on a single device.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { IoTClient, GetCommandExecutionCommand } from "@aws-sdk/client-iot"; // ES Modules import
// const { IoTClient, GetCommandExecutionCommand } = require("@aws-sdk/client-iot"); // CommonJS import
const client = new IoTClient(config);
const input = { // GetCommandExecutionRequest
executionId: "STRING_VALUE", // required
targetArn: "STRING_VALUE", // required
includeResult: true || false,
};
const command = new GetCommandExecutionCommand(input);
const response = await client.send(command);
// { // GetCommandExecutionResponse
// executionId: "STRING_VALUE",
// commandArn: "STRING_VALUE",
// targetArn: "STRING_VALUE",
// status: "CREATED" || "IN_PROGRESS" || "SUCCEEDED" || "FAILED" || "REJECTED" || "TIMED_OUT",
// statusReason: { // StatusReason
// reasonCode: "STRING_VALUE", // required
// reasonDescription: "STRING_VALUE",
// },
// result: { // CommandExecutionResultMap
// "<keys>": { // CommandExecutionResult
// S: "STRING_VALUE",
// B: true || false,
// BIN: new Uint8Array(),
// },
// },
// parameters: { // CommandExecutionParameterMap
// "<keys>": { // CommandParameterValue
// S: "STRING_VALUE",
// B: true || false,
// I: Number("int"),
// L: Number("long"),
// D: Number("double"),
// BIN: new Uint8Array(),
// UL: "STRING_VALUE",
// },
// },
// executionTimeoutSeconds: Number("long"),
// createdAt: new Date("TIMESTAMP"),
// lastUpdatedAt: new Date("TIMESTAMP"),
// startedAt: new Date("TIMESTAMP"),
// completedAt: new Date("TIMESTAMP"),
// timeToLive: new Date("TIMESTAMP"),
// };
GetCommandExecutionCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
executionId Required | string | undefined | The unique identifier for the command execution. This information is returned as a response of the |
targetArn Required | string | undefined | The Amazon Resource Number (ARN) of the device on which the command execution is being performed. |
includeResult | boolean | undefined | Can be used to specify whether to include the result of the command execution in the |
GetCommandExecutionCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
commandArn | string | undefined | The Amazon Resource Number (ARN) of the command. For example, |
completedAt | Date | undefined | The timestamp, when the command execution was completed. |
createdAt | Date | undefined | The timestamp, when the command execution was created. |
executionId | string | undefined | The unique identifier of the command execution. |
executionTimeoutSeconds | number | undefined | Specifies the amount of time in seconds that the device can take to finish a command execution. A timer starts when the command execution is created. If the command execution status is not set to another terminal state before the timer expires, it will automatically update to |
lastUpdatedAt | Date | undefined | The timestamp, when the command execution was last updated. |
parameters | Record<string, CommandParameterValue> | undefined | The list of parameters that the |
result | Record<string, CommandExecutionResult> | undefined | The result value for the current state of the command execution. The status provides information about the progress of the command execution. The device can use the result field to share additional details about the execution such as a return value of a remote function call. If you use the |
startedAt | Date | undefined | The timestamp, when the command execution was started. |
status | CommandExecutionStatus | undefined | The status of the command execution. After your devices receive the command and start performing the operations specified in the command, it can use the |
statusReason | StatusReason | undefined | Your devices can use this parameter to provide additional context about the status of a command execution using a reason code and description. |
targetArn | string | undefined | The Amazon Resource Number (ARN) of the device on which the command execution is being performed. |
timeToLive | Date | undefined | The time to live (TTL) parameter that indicates the duration for which executions will be retained in your account. The default value is six months. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
InternalServerException | server | Internal error from the service that indicates an unexpected error or that the service is unavailable. |
ResourceNotFoundException | client | The specified resource does not exist. |
ThrottlingException | client | The rate exceeds the limit. |
ValidationException | client | The request is not valid. |
IoTServiceException | Base exception class for all service exceptions from IoT service. |