Queries the Thing Specification Language (TSL) model of a product.

Limits

Each Alibaba Cloud account can run a maximum of 20 queries per second (QPS).

Note RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesGetThingModelTsl

The operation that you want to perform. Set the value to GetThingModelTsl.

IotInstanceIdStringNoiot_instc_pu****_c*-v64********

The ID of the instance. You can view the instance ID on the Overview page in the IoT Platform console.

Important
  • If your instance has an ID, you must configure this parameter. If you do not set this parameter, the call fails.
  • If your instance has no Overview page or ID, you do not need to set this parameter.

For more information, see Overview.

ProductKeyStringNoa1BwAGV****

The ProductKey of the product.

You can view the ProductKey on the Product Details page of the IoT Platform console. You can also obtain the ProductKey by calling the QueryProductList operation.

ModelVersionStringNov1.0.0

The version number of the TSL model to be queried.

If you do not specify this parameter, IoT Platform returns the draft TSL model that is unpublished.

SimpleBooleanNotrue

Specifies whether to retrieve a simplified TSL model.

  • true: retrieves a simplified TSL model.

    A simplified TSL model includes only the identifier and dataType attributes of properties, services, events, and related input or output parameters. Simplified TSL models can be used by device developers for reference.

  • false: retrieves the complete TSL model.

    A complete TSL model includes all the parameters and values of properties, services, and events. Complete TSL models can be used by cloud application developers for reference.

Default value: false.

FunctionBlockIdStringNoBatteryModule

The identifier of the custom TSL module. Each identifier is unique in a product.

If you do not specify this parameter, the default module is queried.

In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information, see Common request parameters.

Response parameters

ParameterTypeExampleDescription
CodeStringiot.system.SystemException

The error code returned if the call fails. For more information, see Error codes.

DataStruct

The TSL data returned if the call is successful.

TslStrString{\"schema\":\"https://iotx-tsl.oss-ap-southeast-1.aliyuncs.com/schema.json\",\"profile\":{\"productKey\":\"a14TeWI****\"},\"properties\":[{\"identifier\":\"Humidity\"}]}

The string of the TSL model.

TslUriStringhttps://iotx-pop-dsl.oss-cn-shanghai.aliyuncs.com/thing/a14TeWI****/model.json?Expires=1581947119&OSSAccessKeyId=LTAIuFOwFSR9****&Signature=5i389hacjdj3t%2FnrHmQpEUfnxw****

The URI that is used to store the TSL data in Object Storage Service (OSS). The URI is valid for 60 minutes.

ErrorMessageStringA system exception occurred.

The error message returned if the call fails.

RequestIdStringE55E50B7-40EE-4B6B-8BBE-D3ED55CCF565

The ID of the request.

SuccessBooleantrue

Indicates whether the call was successful.

  • true: The call was successful.
  • false: The call failed.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=GetThingModelTsl
&ProductKey=a1bPo9p****
&ModelVersion=v1.0.0
&Simple=false
&<Common request parameters>

Sample success responses

XML format

<GetThingModelTslResponse>
  <Data>
        <TslUri>https://iotx-pop-dsl.oss-cn-shanghai.aliyuncs.com/thing/a14TeWI****/model.json?Expires=1581947119&amp;OSSAccessKeyId=LTAIuFOwFSR9****&amp;Signature=5i389hacjdj3t%2FnrHmQpEUfnx****</TslUri>
        <TslStr>{"schema":"https://iotx-tsl.oss-ap-southeast-1.aliyuncs.com/schema.json","profile":{"productKey":"a14***"},"properties":[{"identifier":"Humidity","name":"Humidity","accessMode":"rw","required":false,"dataType":{"type":"int","specs":{"min":"55","max":"60","unit":"%","step":"1"}}},{"identifier":"Temperature","name":"Temperature","accessMode":"rw","required":false,"dataType":{"type":"float","specs":{"min":"26","max":"28","unit":"°C","step":"0.01"}}}],"events":[{"identifier":"post","name":"post","type":"info","required":true,"desc":"Submit properties","method":"thing.event.property.post","outputData":[{"identifier":"Humidity","name":"Humidity","dataType":{"type":"int","specs":{"min":"55","max":"60","unit":"%","step":"1"}}},{"identifier":"Temperature","name":"Temperature","dataType":{"type":"float","specs":{"min":"26","max":"28","unit":"°C","step":"0.01"}}}]}],"services":[{"identifier":"set","name":"set","required":true,"callType":"async","desc":"Set properties","method":"thing.service.property.set","inputData":[{"identifier":"Humidity","name":"Humidity","dataType":{"type":"int","specs":{"min":"55","max":"60","unit":"%","step":"1"}}},{"identifier":"Temperature","name":"Temperature","dataType":{"type":"float","specs":{"min":"26","max":"28","unit":"°C","step":"0.01"}}}],"outputData":[]},{"identifier":"get","name":"get","required":true,"callType":"async","desc":"Obtain properties","method":"thing.service.property.get","inputData":["Humidity","Temperature"],"outputData":[{"identifier":"Humidity","name":"Humidity","dataType":{"type":"int","specs":{"min":"55","max":"60","unit":"%","step":"1"}}},{"identifier":"Temperature","name":"Temperature","dataType":{"type":"float","specs":{"min":"26","max":"28","unit":"°C","step":"0.01"}}}]}]}</TslStr>
  </Data>
  <RequestId>C4371E68-F6DB-4D7B-8AD0-D38336E1DF94</RequestId>
  <Success>true</Success>
</GetThingModelTslResponse>

JSON format

{
    "Data": {
        "TslUri": "https://iotx-pop-dsl.oss-cn-shanghai.aliyuncs.com/thing/a14TeWI****/model.json?Expires=1581947119&OSSAccessKeyId=LTAIuFOwFSR9****&Signature=5i389hacjdj3t%2FnrHmQpEUfnx****",
        "TslStr": "{\"schema\":\"https://iotx-tsl.oss-ap-southeast-1.aliyuncs.com/schema.json \",\" profile\":[\"productKey\":\"a14*** \",\" properties\":[{\"identifier\":\"Humidity\",\"name\":\"Humidity\",\" accessMode\":\"rw\",\"required\":false,\"dataType\":{\"type\":\"int\",\"specs\":{\"min\":\"55\",\"max\":\"60\",\"unit\":\"%\",\"step\":\" 1\"****** \"identifier\":\"Temperature\",\"name\":\"Temperature\",\"accessMode\":\"rw\",\"required\":false,\"dataType\":[\"type\": \"float\",\"specs\":{\"min\":\"26\",\"max\":\"28\",\"unit\":\"°C\",\"step\":\"0.01\"}}}],\"events\": [{\"identifier\":\"post\",\"name\":\"post\",\"type\":\"info\",\"required\":true,\"desc\":\"Submit properties reporting \",\"method\":\"thing.event.property.post\", \"outputData\":[{\"identifier\":\"Humidity\",\"name\":\"Humidity\",\"dataType\" :%\ "type\":\"int\",\"specs\" :%\ "min":\"55\", \"max\":\"60\",\"unit\":\"%\",\"step\":\"1\" ****** \"identifier\":\"Temperature\",\"name\":\"Temperature\",\"dataType\": {\"type\":\"float\",\"specs\":{\"min\":\"26\",\"max\":\"28\",\"unit\":\"°C\",\"step\":\"0.01\"}}}] }],\"services\":[{\"identifier\":\"set\",\"name\":\"set\",\"required\":true,\"callType\":\"async\",\"desc\":\"Set properties\",\" method\":\"thing.service.property.set\",\" inputData\":[{\"identifier\":\"Humidity\",\"name\":\" Humidity\",\"dataType\":\"type\":\"int\",\" specs\":\" min\":\"55\",\"max\":\"60\",\"unit\":\"%\",\"step\":\"1\"}}},{\"identifier\":\"Temperature\",\"name\":\" Temperature \",\"dataType\":[\"type\":\"float\",\" specs\":[\"min\":\"26\",\" max\":\"28\",\"unit\":\"°C\",\"step\": \"0.01\"}}}],\"outputData\":[]},{\"identifier\":\"get\",\"name\":\"get\",\"required\":true,\"callType\":\"async\",\"desc\":\"Obtain properties\",\"method\":\"thing.service.property.get\",\"inputData\":[\"Humidity\",\"Temperature\"],\"outputData\":[{\"identifier\":\"Humidity\",\"name\":\"Humidity \", \"dataType\":{\"type\":\"int\",\"specs\":{\"min\":\"55\",\"max\":\"60\",\"unit\":\"%\",\"step\":\" 1\"****** \"identifier\":\"Temperature\",\"name\":\"Temperature\",\"dataType\":\\"type\":\"float\",\"specs\":[\"min ":\"26\", \"max\":\"28\",\"unit\":\"°C\",\"step\":\"0.01\"}}}]}]}"
    },
    "RequestId": "C4371E68-F6DB-4D7B-8AD0-D38336E1DF94",
    "Success": true
}

Error codes

For a list of error codes, visit the API Error Center.