# GetThingModelTsl

调用该接口查询指定产品的物模型TSL。

# 请求参数

名称 类型 是否必选 示例值 描述
Action String GetThingModelTsl 系统规定参数。取值:GetThingModelTsl。
IotInstanceId String 7159249318287***** 实例ID。您可在物联网平台控制台的实例概览页面,查看当前实例的ID。
ProductKey String a1BwAGV**** 产品的ProductKey。可以在物联网平台控制台产品页查看。
Simple Boolean true 是否获取精简版物模型信息。true:获取精简版物模型TSL。精简版物模型TSL中仅包含属性、服务、事件及入参和出参的标识符(identifier)和数据类型(dataType),可供设备端开发人员参考。false:获取完整的物模型TSL。完整物模型TSL中包含属性、服务和事件定义的所有参数和取值,可供云端应用开发人员参考。不传入此参数,则默认为false,获取完整的物模型信息。

# 返回数据

名称 类型 示例值 描述
Code String iot.system.SystemException 调用失败时,返回的错误码。
Data Struct 调用成功时,返回的物模型信息。
TslStr String {"properties":[],"events":[{"identifier":"post","type":"info","outputData":[]}],"services":[{"identifier":"set","inputData":[],"outputData":[]},{"identifier":"get","inputData":[],"outputData":[]}]} 物模型的TSL字符串。
ErrorMessage String 系统异常 调用失败时,返回的出错信息。
RequestId String 2E6yNiZUHPeisuwWWbpxwabzf9LdmSWJ 平台为该请求生成的唯一标识符。
Success Boolean true 表示是否调用成功。true:调用成功。false:调用失败。

# 示例

请求示例

http://open.${区域}.fenydata.com/fenydata-java-open/?Action=GetThingModelTsl
&IotInstanceId=70255861902711****
&ProductKey=a1BwAGV****
&Simple=false
&<公共请求参数>

正常返回示例

XML格式

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xml>
  <Data>
    <TslStr>
      {"events": [{"desc": "属性上报", "name": "post", "type": "info", "method": "thing.event.property.post",
      "required": true, "identifier": "post", "outputData": [{"name": "温度", "dataType": {"type": "float", "specs":
      {"max": "100", "min": "0", "step": "0.1", "unit": "℃", "unitName": "摄氏度"}}, "identifier": "temperature"}]},
      {"desc": "", "name": "侦测报警", "type": "alert", "method": "thing.event.AlarmEvent.post", "required": true,
      "identifier": "AlarmEvent", "outputData": [{"name": "告警类型", "dataType": {"type": "enum", "specs": {"1":
      "移动侦测", "2": "声音侦测"}}, "identifier": "AlarmType"}]}], "schema": "", "profile": {"version": "1.0",
      "productKey": "Zlpfl15lpPD"}, "services": [{"desc": "属性设置", "name": "set", "method":
      "thing.service.property.set", "callType": "async", "required": true, "inputData": [{"name": "温度", "dataType":
      {"type": "float", "specs": {"max": "100", "min": "0", "step": "0.1", "unit": "℃", "unitName": "摄氏度"}},
      "identifier": "temperature"}], "identifier": "set", "outputData": []}, {"desc": "属性获取", "name": "get",
      "method": "thing.service.property.get", "callType": "async", "required": true, "inputData": ["temperature"],
      "identifier": "get", "outputData": [{"name": "温度", "dataType": {"type": "float", "specs": {"max": "100", "min":
      "0", "step": "0.1", "unit": "℃", "unitName": "摄氏度"}}, "identifier": "temperature"}]}, {"desc": "", "name":
      "重启", "method": "thing.service.Reboot", "callType": "sync", "required": true, "inputData": [{"name": "a",
      "dataType": {"type": "int", "specs": {"max": "10", "min": "1", "step": "1", "unit": "cm", "unitName": "厘米"}},
      "identifier": "a1"}], "identifier": "Reboot", "outputData": [{"name": "b", "dataType": {"type": "int", "specs":
      {"max": "10", "min": "1", "step": "1", "unit": "kg", "unitName": "千克"}}, "identifier": "b1"}]}], "properties":
      [{"desc": "", "name": "温度", "dataType": {"type": "float", "specs": {"max": "100", "min": "0", "step": "0.1",
      "unit": "℃", "unitName": "摄氏度"}}, "required": true, "accessMode": "rw", "identifier": "temperature"}]}
    </TslStr>
  </Data>
  <RequestId>2E6yNiZUHPeisuwWWbpxwabzf9LdmSWJ</RequestId>
  <Success>true</Success>
</xml>

JSON格式

{
  "Data": {
    "TslStr": "{\"events\": [{\"desc\": \"属性上报\", \"name\": \"post\", \"type\": \"info\", \"method\": \"thing.event.property.post\", \"required\": true, \"identifier\": \"post\", \"outputData\": [{\"name\": \"温度\", \"dataType\": {\"type\": \"float\", \"specs\": {\"max\": \"100\", \"min\": \"0\", \"step\": \"0.1\", \"unit\": \"℃\", \"unitName\": \"摄氏度\"}}, \"identifier\": \"temperature\"}]}, {\"desc\": \"\", \"name\": \"侦测报警\", \"type\": \"alert\", \"method\": \"thing.event.AlarmEvent.post\", \"required\": true, \"identifier\": \"AlarmEvent\", \"outputData\": [{\"name\": \"告警类型\", \"dataType\": {\"type\": \"enum\", \"specs\": {\"1\": \"移动侦测\", \"2\": \"声音侦测\"}}, \"identifier\": \"AlarmType\"}]}], \"schema\": \"\", \"profile\": {\"version\": \"1.0\", \"productKey\": \"Zlpfl15lpPD\"}, \"services\": [{\"desc\": \"属性设置\", \"name\": \"set\", \"method\": \"thing.service.property.set\", \"callType\": \"async\", \"required\": true, \"inputData\": [{\"name\": \"温度\", \"dataType\": {\"type\": \"float\", \"specs\": {\"max\": \"100\", \"min\": \"0\", \"step\": \"0.1\", \"unit\": \"℃\", \"unitName\": \"摄氏度\"}}, \"identifier\": \"temperature\"}], \"identifier\": \"set\", \"outputData\": []}, {\"desc\": \"属性获取\", \"name\": \"get\", \"method\": \"thing.service.property.get\", \"callType\": \"async\", \"required\": true, \"inputData\": [\"temperature\"], \"identifier\": \"get\", \"outputData\": [{\"name\": \"温度\", \"dataType\": {\"type\": \"float\", \"specs\": {\"max\": \"100\", \"min\": \"0\", \"step\": \"0.1\", \"unit\": \"℃\", \"unitName\": \"摄氏度\"}}, \"identifier\": \"temperature\"}]}, {\"desc\": \"\", \"name\": \"重启\", \"method\": \"thing.service.Reboot\", \"callType\": \"sync\", \"required\": true, \"inputData\": [{\"name\": \"a\", \"dataType\": {\"type\": \"int\", \"specs\": {\"max\": \"10\", \"min\": \"1\", \"step\": \"1\", \"unit\": \"cm\", \"unitName\": \"厘米\"}}, \"identifier\": \"a1\"}], \"identifier\": \"Reboot\", \"outputData\": [{\"name\": \"b\", \"dataType\": {\"type\": \"int\", \"specs\": {\"max\": \"10\", \"min\": \"1\", \"step\": \"1\", \"unit\": \"kg\", \"unitName\": \"千克\"}}, \"identifier\": \"b1\"}]}], \"properties\": [{\"desc\": \"\", \"name\": \"温度\", \"dataType\": {\"type\": \"float\", \"specs\": {\"max\": \"100\", \"min\": \"0\", \"step\": \"0.1\", \"unit\": \"℃\", \"unitName\": \"摄氏度\"}}, \"required\": true, \"accessMode\": \"rw\", \"identifier\": \"temperature\"}]}"
  },
  "RequestId": "2E6yNiZUHPeisuwWWbpxwabzf9LdmSWJ",
  "Success": true
}