CreateCommand
Creates a command. A command contains reusable configurations that can be applied before they are sent to the devices.
Request Syntax
PUT /commands/commandId
HTTP/1.1
Content-type: application/json
{
"description": "string
",
"displayName": "string
",
"mandatoryParameters": [
{
"defaultValue": {
"B": boolean
,
"BIN": blob
,
"D": number
,
"I": number
,
"L": number
,
"S": "string
",
"UL": "string
"
},
"description": "string
",
"name": "string
",
"value": {
"B": boolean
,
"BIN": blob
,
"D": number
,
"I": number
,
"L": number
,
"S": "string
",
"UL": "string
"
}
}
],
"namespace": "string
",
"payload": {
"content": blob
,
"contentType": "string
"
},
"roleArn": "string
",
"tags": [
{
"Key": "string
",
"Value": "string
"
}
]
}
URI Request Parameters
The request uses the following URI parameters.
- commandId
-
A unique identifier for the command. We recommend using UUID. Alpha-numeric characters, hyphens, and underscores are valid for use here.
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
[a-zA-Z0-9_-]+
Required: Yes
Request Body
The request accepts the following data in JSON format.
- description
-
A short text decription of the command.
Type: String
Length Constraints: Maximum length of 2028.
Pattern:
[^\p{C}]*
Required: No
- displayName
-
The user-friendly name in the console for the command. This name doesn't have to be unique. You can update the user-friendly name after you define it.
Type: String
Length Constraints: Maximum length of 64.
Pattern:
[^\p{C}]*
Required: No
- mandatoryParameters
-
A list of parameters that are required by the
StartCommandExecution
API. These parameters need to be specified only when using theAWS-IoT-FleetWise
namespace. You can either specify them here or when running the command using theStartCommandExecution
API.Type: Array of CommandParameter objects
Array Members: Minimum number of 1 item.
Required: No
- namespace
-
The namespace of the command. The MQTT reserved topics and validations will be used for command executions according to the namespace setting.
Type: String
Valid Values:
AWS-IoT | AWS-IoT-FleetWise
Required: No
- payload
-
The payload object for the command. You must specify this information when using the
AWS-IoT
namespace.You can upload a static payload file from your local storage that contains the instructions for the device to process. The payload file can use any format. To make sure that the device correctly interprets the payload, we recommend you to specify the payload content type.
Type: CommandPayload object
Required: No
- roleArn
-
The IAM role that you must provide when using the
AWS-IoT-FleetWise
namespace. The role grants IoT Device Management the permission to access IoT FleetWise resources for generating the payload for the command. This field is not required when you use theAWS-IoT
namespace.Type: String
Length Constraints: Minimum length of 20. Maximum length of 2048.
Required: No
-
Name-value pairs that are used as metadata to manage a command.
Type: Array of Tag objects
Required: No
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"commandArn": "string",
"commandId": "string"
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- commandArn
-
The Amazon Resource Number (ARN) of the command. For example,
arn:aws:iot:<region>:<accountid>:command/<commandId>
Type: String
- commandId
-
The unique identifier for the command.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 64.
Pattern:
[a-zA-Z0-9_-]+
Errors
- ConflictException
-
The request conflicts with the current state of the resource.
HTTP Status Code: 409
- InternalServerException
-
Internal error from the service that indicates an unexpected error or that the service is unavailable.
HTTP Status Code: 500
- ServiceQuotaExceededException
-
Service quota has been exceeded.
HTTP Status Code: 402
- ThrottlingException
-
The rate exceeds the limit.
HTTP Status Code: 400
- ValidationException
-
The request is not valid.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: