V2.1 Cancel Command¶
Cancel cached commands. If a commandId
is specified, the command with the commandId
will be cancelled. If no commandId
is specified, all the device’s cached commands will be cancelled.
This API is available in EnOS 2.1.0 and above.
Operation Permissions¶
Ensure that the application has been granted with the invoking permissions. For more information, see Getting API Calling Permissions.
Request Format¶
POST https://{apigw-address}/connect-service/v2.1/commands?action=cancel
Request Parameters (URI)¶
Note
Use one of the following methods to specify the device:
Include
assetId
in the requestInclude
productKey
+deviceKey
in the request
Name |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
orgId |
Query |
Mandatory |
String |
The organization ID which the asset belongs to. How to get orgId>> |
assetId |
Query |
Optional (See Note above) |
String |
The asset ID. How to get assetId>> |
productKey |
Query |
Optional (See Note above) |
String |
The product key. To be used with |
deviceKey |
Query |
Optional (See Note above) |
String |
The device key. To be used with |
commandId |
Query |
Mandatory |
String |
The command ID. |
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Array of Command Structs |
The list of cancelled commands. For details, see Command Struct. |
Command Struct ¶
Name |
Data Type |
Description |
---|---|---|
commandId |
String |
The command ID. |
orgId |
String |
The organization ID which the asset belongs to. |
productKey |
String |
The product key. |
deviceKey |
String |
The device key. |
assetId |
String |
The asset ID. |
createTime |
String |
The time when the command was invoked. |
createLocaltime |
String |
The local time when the command was invoked. |
commandType |
Integer |
The command type.
|
commandName |
StringI18n |
The command name. |
timeout |
Integer |
The command timeout duration. Its unit is seconds and its range is [1-60]. The default value is 30. |
pendingTtl |
Long |
The command cache duration. Its unit is seconds and its range is [ 0 - 48 * 60 * 60 ], which is 0 by default. If the pendingTtl is 0, it indicates that the commands will be executed immediately. |
state |
Integer |
The command status, which is represented by an integer from 1-7.
|
tslIdentifier |
String |
Command Identifier. |
inputData |
Map (Key is of String type and the Value is of String, Number, Array or Object type) |
The input data. The key is the input parameter identifier, and the value’s data type needs to conform to the model’s definition. |
outputData |
Map (Key is of String type and the Value is of String, Number, Array or Object type) |
The output data. The key is the output parameter identifier, and the value is the service’s output result. The value’s data type needs to conform to the model’s definition |
Error Codes¶
Code |
Message |
Description |
---|---|---|
11404 |
Command not found |
The |
11905 |
Cache message cancel error, not created state |
The command is already revoked. |
Samples¶
Request Sample¶
url: https://{apigw-address}/connect-service/v2.1/commands?action=cancel&deviceKey=yourDeviceKey&productKey=yourProductKey&orgId=yourOrgId&commandId=2278935391225618432
method: POST
Return Sample¶
{
"code": 0,
"msg": "OK",
"requestId": "7d863d517eae4f18a2776452eb1305bb",
"data": [{
"commandId": "2278935391225618432",
"orgId": "yourOrgId",
"productKey": "yourProductKey",
"deviceKey": "yourDeviceKey",
"assetId": "yourAssetId",
"createTime": "1560505243577",
"createLocalTime": "2019-06-14 17:40:23",
"commandType": 1,
"commandName": {
"defaultValue": "Int_value",
"i18nValue": {
"en_US": "Int_value"
}
},
"timeout": 1,
"pendingTtl": 6000,
"state": 1,
"tslIdentifier": "Int_value",
"inputData": 222,
"outputData": null
}]
}
SDK Samples¶
You can access the SDK samples for Connection Service on GitHub: