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

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to GetThingModelTsl.
ProductKey String Yes The key of the product.

You can go to the Product page of the IoT Platform console to view the product key. You can also call the QueryProductList operation to query the value of the ProductKey parameter.

ModelVersion String No The version of the TSL to be queried.

If you do not specify this parameter, the TSL that is in the draft status is queried.

Simple Boolean No Specifies whether to retrieve a simplified TSL.
  • true: retrieves a simplified TSL.

    A simplified TSL only includes the identifier and dataType attributes of input and output parameters that are defined in properties, services, and events. Simplified TSLs can be used by the device developers for reference.

  • false: retrieves the complete TSL.

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

Default value: false.

IotInstanceId String No The ID of the instance. This parameter is not required for public instances. However, the parameter is required for the instances that you have purchased.
Common request parameters - Yes For more information, see Common parameters.

Response parameters

Parameter Type Description
RequestId String The globally unique ID generated by Alibaba Cloud for the request.
Success Boolean Indicates whether the call was successful. true indicates that the call was successful. false indicates that the call failed.
ErrorMessage String The error message returned if the call failed.
Code String The error code returned if the call failed. For information about error codes, see Error codes.
Data Data The TSL returned if the call was successful. For more information, see the following Data table.
Table 1. Data
Parameter Type Description
TslStr String The string of the TSL.
TslUri String The URI that is used to store the TSL data in Object Storage Service (OSS). The URI is valid for 60 minutes.

Examples

Sample requests

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

Sample responses

  • JSON format
    {
      "RequestId":"57b144cf-09fc-4916-a272-a62902d5b207",
      "Success":true,
      "Data":{
        "TslStr":"{\"profile\":{\"productKey\": \"a1bPo9p****\"},\"services\":[],\"properties\":[],\"events\":[]}",
        "TslUri":"https://..."
      }
    }
  • XML format
    <?xml version='1.0' encoding='utf-8'?>
    <GetThingModelTslResponse>
        <RequestId>57b144cf-09fc-4916-a272-a62902d5b207</RequestId>
        <Success>true</Success>
        <Data>
            <TslStr>{\"profile\":{\"productKey\": \"a1bPo9p****\"},\"services\":[],\"properties\":[],\"events\":[]}</TslStr>
            <TslUri>https://...</TslUri>
        </Data>
    </GetThingModelTslResponse>