Modules - Invoke Method
在裝置的模組上叫用直接方法。 如需相關資訊,請參閱 https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-direct-methods 。
POST https://fully-qualified-iothubname.azure-devices.net/twins/{deviceId}/modules/{moduleId}/methods?api-version=2021-04-12
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
device
|
path | True |
string |
裝置的唯一標識碼。 |
|
module
|
path | True |
string |
模組的唯一標識碼。 |
|
api-version
|
query | True |
string |
Api 的版本。 |
要求本文
| 名稱 | 類型 | Description |
|---|---|---|
| connectTimeoutInSeconds |
integer (int32) |
|
| methodName |
string |
要執行之方法的名稱。 |
| payload |
object |
JSON 格式的直接方法承載,大小上限為 128kb。 |
| responseTimeoutInSeconds |
integer (int32) |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
還行。 |
定義
| 名稱 | Description |
|---|---|
|
Cloud |
在裝置上執行直接方法的參數。 |
|
Cloud |
代表Device方法調用結果。 |
CloudToDeviceMethod
在裝置上執行直接方法的參數。
| 名稱 | 類型 | Description |
|---|---|---|
| connectTimeoutInSeconds |
integer (int32) |
|
| methodName |
string |
要執行之方法的名稱。 |
| payload |
object |
JSON 格式的直接方法承載,大小上限為 128kb。 |
| responseTimeoutInSeconds |
integer (int32) |
CloudToDeviceMethodResult
代表Device方法調用結果。
| 名稱 | 類型 | Description |
|---|---|---|
| payload |
object |
方法調用結果承載。 |
| status |
integer (int32) |
方法調用結果狀態。 |