調用該接口查看指定產品物模型中的功能定義詳情。
使用說明
物模型的功能定義詳情中包含物模型中的所有屬性、服務和事件定義。
如果產品物模型中添加了自定義模塊,請求參數FunctionBlockId的值為空時,可獲取到自定義模塊列表;不為空時,可獲取指定自定義模塊的功能定義。
返回參數ThingModelJson取值的數據格式說明,請參見ThingModelJson數據說明。
QPS限制
單個阿里云賬號調用該接口的每秒請求數(QPS)最大限制為10。
調試
您可以在OpenAPI Explorer中直接運行該接口,免去您計算簽名的困擾。運行成功后,OpenAPI Explorer可以自動生成SDK代碼示例。
請求參數
名稱 | 類型 | 是否必選 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | QueryThingModel | 系統規定參數。取值:QueryThingModel。 |
IotInstanceId | String | 否 | iot_instc_pu****_c*-v64******** | 實例ID。您可在物聯網平臺控制臺的實例概覽頁面,查看當前實例的ID。 重要
實例的更多信息,請參見實例概述。 |
ResourceGroupId | String | 否 | rg-acfm4l5tcwd**** | 資源組ID。 重要 目前,物聯網平臺僅支持實例維度的資源組管理。請求參數ResourceGroupId配置已無效,無需再傳入。
|
ProductKey | String | 否 | a1BwAGV**** | 產品的ProductKey。 |
ModelVersion | String | 否 | v1.0.0 | 要查看的物模型版本號。 可調用ListThingModelVersion查看產品下的物模型版本號。 不傳入此參數,則查詢草稿狀態的物模型功能定義;傳入此參數,則查詢指定版本的物模型功能定義。 |
FunctionBlockId | String | 否 | BatteryModule | 物模型自定義模塊標識符,在產品中具有唯一性。 不傳入此參數時,查詢默認模塊數據。 |
調用API時,除了本文介紹的該API的特有請求參數,還需傳入公共請求參數。公共請求參數說明,請參見公共參數文檔。
返回數據
名稱 | 類型 | 示例值 | 描述 |
---|---|---|---|
Code | String | iot.system.SystemException | 調用失敗時,返回的錯誤碼。更多信息,請參見錯誤碼。 |
Data | Struct | 調用成功時,返回的數據。 |
|
ThingModelJson | String | { "productKey":"a1Jw4id***", "_ppk":{ "version":"1.1", "description":"xxx" }, "properties":[ { "identifier": "SimCardType", "dataSpecs": { "max": "1", "dataType": "INT", "unit": "mmHg", "min": "0", "step": "1" }, "std": false, "custom": true, "dataType": "INT", "rwFlag": "READ_ONLY", "productKey": "a1Jw4idFWHX", "required": false, "customFlag": true, "name": "sim卡類型" } ], "services":[], "events":[] } | 物模型的功能定義。默認模塊和自定義模塊的物模型數據格式不同。 ThingModelJson取值的數據格式說明,請參見ThingModelJson數據說明。 |
ErrorMessage | String | 系統異常 | 調用失敗時,返回的出錯信息。 |
ProductKey | String | a1BwAGV**** | 產品的ProductKey。 |
RequestId | String | E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565 | 阿里云為該請求生成的唯一標識符。 |
Success | Boolean | true | 表示是否調用成功。
|
示例
請求示例
https://iot.cn-shanghai.aliyuncs.com/?Action=QueryThingModel
&ProductKey=a1bPo9p****
&ModelVersion=v1.0.0
&<公共請求參數>
正常返回示例
XML
格式
<QueryThingModelResponse>
<RequestId>1F9041A2-ED5B-4A5A-9C44-598E28C0B434</RequestId>
<Data>
<ThingModelJson>{"_ppk":{"version":"1594253010934"},"events":[],"productKey":"a114xeJ****","properties":[{"configCode":"8C03F0EEC63D4897BF2637F89AE36B011594227294067","custom":true,"customFlag":true,"dataSpecs":{"custom":true,"dataType":"INT","max":"1","min":"0","step":"1","unit":"ppb"},"dataType":"INT","description":"1","extendConfig":"{\"originalDataType\":{\"specs\":{\"registerCount\":1,\"reverseRegister\":0,\"swap16\":0},\"type\":\"bool\"},\"identifier\":\"WakeUpData\",\"registerAddress\":\"0x04\",\"scaling\":1,\"writeFunctionCode\":0,\"operateType\":\"inputStatus\",\"pollingTime\":1000,\"trigger\":1}","identifier":"WakeUpData","name":"喚醒數據","productKey":"a114xeJGj2p","required":false,"rwFlag":"READ_ONLY","std":false}],"services":[]}</ThingModelJson>
</Data>
<Success>true</Success>
</QueryThingModelResponse>
JSON
格式
{
"RequestId": "1F9041A2-ED5B-4A5A-9C44-598E28C0B434",
"Data": {
"ThingModelJson": "{\"_ppk\":{\"version\":\"1594253010934\"},\"events\":[],\"productKey\":\"a114xeJ****\",\"properties\":[{\"configCode\":\"8C03F0EEC63D4897BF2637F89AE36B011594227294067\",\"custom\":true,\"customFlag\":true,\"dataSpecs\":{\"custom\":true,\"dataType\":\"INT\",\"max\":\"1\",\"min\":\"0\",\"step\":\"1\",\"unit\":\"ppb\"},\"dataType\":\"INT\",\"description\":\"1\",\"extendConfig\":\"{\\\"originalDataType\\\":{\\\"specs\\\":{\\\"registerCount\\\":1,\\\"reverseRegister\\\":0,\\\"swap16\\\":0},\\\"type\\\":\\\"bool\\\"},\\\"identifier\\\":\\\"WakeUpData\\\",\\\"registerAddress\\\":\\\"0x04\\\",\\\"scaling\\\":1,\\\"writeFunctionCode\\\":0,\\\"operateType\\\":\\\"inputStatus\\\",\\\"pollingTime\\\":1000,\\\"trigger\\\":1}\",\"identifier\":\"WakeUpData\",\"name\":\"喚醒數據\",\"productKey\":\"a114xeJGj2p\",\"required\":false,\"rwFlag\":\"READ_ONLY\",\"std\":false}],\"services\":[]}"
},
"Code": "",
"Success": true
}