Devices - Run Command
デバイス コマンドを実行する
デバイスでコマンドを実行します。
POST https://{subdomain}.{baseDomain}/api/devices/{deviceId}/commands/{commandName}?api-version=2022-07-31
URI パラメーター
| 名前 | / | 必須 | 型 | 説明 |
|---|---|---|---|---|
|
base
|
path | True |
string |
すべての Azure IoT Central サービス要求のベース ドメイン。 |
|
command
|
path | True |
string |
このデバイス コマンドの名前。 |
|
device
|
path | True |
string |
デバイスの一意の ID。 |
|
subdomain
|
path | True |
string |
アプリケーション サブドメイン。 |
|
api-version
|
query | True |
string |
呼び出される API のバージョン。 |
要求本文
| 名前 | 型 | 説明 |
|---|---|---|
| connectionTimeout |
integer (int32) minimum: 0maximum: 30 |
切断されたデバイスがオンラインになるまで待機する接続タイムアウト (秒単位)。 既定値は 0 秒です。 |
| request |
device コマンドのペイロードは、任意のプリミティブ型またはオブジェクトをサポートします。 |
|
| responseTimeout |
integer (int32) minimum: 5maximum: 30 |
デバイスでのコマンドの完了を待機する応答タイムアウト (秒単位)。 既定値は 30 秒です。 |
応答
| 名前 | 型 | 説明 |
|---|---|---|
| 201 Created |
成功 |
|
| Other Status Codes |
IoT Central サービスから受信したエラー応答。 ヘッダー x-ms-error-code: string |
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
| 名前 | 説明 |
|---|---|
| user_impersonation | ユーザー アカウントを偽装する |
例
Send command
要求のサンプル
POST https://appsubdomain.azureiotcentral.com/api/devices/mx1/commands/CoolDown?api-version=2022-07-31
{
"request": {
"tempVal": 30
}
}
応答のサンプル
{}
定義
| 名前 | 説明 |
|---|---|
|
Device |
デバイス コマンド定義。 |
| Error |
応答エラーの定義。 |
|
Error |
エラーの詳細情報。 |
DeviceCommand
デバイス コマンド定義。
| 名前 | 型 | 説明 |
|---|---|---|
| connectionTimeout |
integer (int32) minimum: 0maximum: 30 |
切断されたデバイスがオンラインになるまで待機する接続タイムアウト (秒単位)。 既定値は 0 秒です。 |
| id |
string |
デバイス コマンド実行の要求 ID。 |
| request |
device コマンドのペイロードは、任意のプリミティブ型またはオブジェクトをサポートします。 |
|
| response |
デバイス コマンド応答のペイロードは、任意のプリミティブ型またはオブジェクトをサポートします。 |
|
| responseCode |
integer (int32) |
デバイス コマンド応答の状態コード。 |
| responseTimeout |
integer (int32) minimum: 5maximum: 30 |
デバイスでのコマンドの完了を待機する応答タイムアウト (秒単位)。 既定値は 30 秒です。 |
Error
応答エラーの定義。
| 名前 | 型 | 説明 |
|---|---|---|
| error |
現在の要求のエラーの詳細。 |
ErrorDetails
エラーの詳細情報。
| 名前 | 型 | 説明 |
|---|---|---|
| code |
string |
エラー コード。 |
| message |
string |
エラー メッセージの詳細。 |
| requestId |
string |
現在の要求の関連付け ID。 |
| time |
string (date-time-rfc1123) |
エラー要求が失敗した時刻。 |