Devices - Run Component Command
執行元件命令
在元件上執行命令。
POST https://{subdomain}.{baseDomain}/api/devices/{deviceId}/components/{componentName}/commands/{commandName}?api-version=2022-07-31
URI 參數
名稱 | 位於 | 必要 | 類型 | Description |
---|---|---|---|---|
base
|
path | True |
string |
所有 Azure IoT Central 服務要求的基底網域。 |
command
|
path | True |
string |
此裝置命令的名稱。 |
component
|
path | True |
string |
裝置元件的名稱。 |
device
|
path | True |
string |
裝置的唯一標識碼。 |
subdomain
|
path | True |
string |
應用程式子域。 |
api-version
|
query | True |
string |
所呼叫之 API 的版本。 |
要求本文
名稱 | 類型 | Description |
---|---|---|
connectionTimeout |
integer |
線上逾時,以秒為單位等候中斷連線的裝置上線。 預設值為 0 秒。 |
request |
裝置命令的承載支援任何基本類型或物件。 |
|
responseTimeout |
integer |
回應逾時,以秒為單位等候裝置上的命令完成。 預設為 30 秒。 |
回應
名稱 | 類型 | Description |
---|---|---|
201 Created |
Success |
|
Other Status Codes |
從 IoT Central 服務收到的錯誤回應。 Headers x-ms-error-code: string |
安全性
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名稱 | Description |
---|---|
user_impersonation | 模擬您的用戶帳戶 |
範例
Send command
Sample Request
POST https://appsubdomain.azureiotcentral.com/api/devices/mx1/components/Thermostat_1o/commands/CoolDown?api-version=2022-07-31
{
"request": {
"tempVal": 30
}
}
Sample Response
{}
定義
名稱 | Description |
---|---|
Device |
裝置命令定義。 |
Error |
回應錯誤定義。 |
Error |
錯誤的詳細資訊。 |
DeviceCommand
裝置命令定義。
名稱 | 類型 | Description |
---|---|---|
connectionTimeout |
integer |
線上逾時,以秒為單位等候中斷連線的裝置上線。 預設值為 0 秒。 |
id |
string |
裝置命令執行的要求識別碼。 |
request |
裝置命令的承載支援任何基本類型或物件。 |
|
response |
裝置命令回應的承載支援任何基本類型或物件。 |
|
responseCode |
integer |
裝置命令回應的狀態代碼。 |
responseTimeout |
integer |
回應逾時,以秒為單位等候裝置上的命令完成。 預設為 30 秒。 |
Error
回應錯誤定義。
名稱 | 類型 | Description |
---|---|---|
error |
目前要求的錯誤詳細數據。 |
ErrorDetails
錯誤的詳細資訊。
名稱 | 類型 | Description |
---|---|---|
code |
string |
錯誤碼。 |
message |
string |
錯誤訊息詳細數據。 |
requestId |
string |
目前要求的相互關聯標識碼。 |
time |
string |
錯誤要求失敗的時間。 |