Queries the TSL definition of a specified product.

Description

The TSL definition includes the definitions of all properties, services, and events in the TSL.

Request parameters

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

You can log on to the IoT Platform console and view it on the Product page. You can also call the QueryProductList operation to obtain the ProductKey value.

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

You can call the ListThingModelVersion operation to view the TSL version of a product.

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

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 IoT Platform 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 fails.
Code String The error code returned if the call fails. For more information about error codes, see Error codes.
Data Struct The data returned when the call is successful. For more information, see the Data table.
Table 1. Data
Parameter Type Description
ThingModelJson String Define features of the TSL. For more information about ThingModelJson, see Data structure of ThingModelJson.

Example:

{
  "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": "simCardType"
    }
  ],
  "services":[],
  "events":[]

}

Examples

Sample requests

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

Sample responses

  • JSON format
    {
      "Data": {
        "ThingModelJson": "{\"productKey\":\"a1bPo9p****\",\"_ppk\":{},\"properties\":[{\"identifier\":\"SimCardType\",\"dataSpecs\":{\"max\":\"1\",\"dataType\":\"INT\",\"unit\":\"mmHg\",\"min\":\"0\",\"step\":\"1\"},\"std\":false,\"custom\":true,\"dataType\":\"INT\",\"rwFlag\":\"READ_ONLY\",\"configCode\":\"03F7B23CD285458AB191E0881F889BE91579420094360\",\"productKey\":\"a1Jw4idFWHX\",\"required\":false,\"customFlag\":true,\"dataSpecsObject\":{\"unit\":\"mmHg\",\"min\":\"0\",\"max\":\"1\",\"dataType\":\"INT\",\"step\":\"1\"},\"name\":\"simCardType\",\"extendConfig\":\"{\\\"originalDataType\\\":{\\\"specs\\\":{\\\"registerCount\\\":1,\\\"reverseRegister\\\":0,\\\"swap16\\\":0},\\\"type\\\":\\\"bool\\\"},\\\"identifier\\\":\\\"SimCardType\\\",\\\"registerAddress\\\":\\\"0x03\\\",\\\"scaling\\\":1,\\\"writeFunctionCode\\\":0,\\\"operateType\\\":\\\"inputStatus\\\",\\\"pollingTime\\\":1000,\\\"trigger\\\":1}\"}],\"services\":[],\"events\":[]}"
      },
      "RequestId": "CAC786EA-048E-4FDC-8B64-961DD4BE4A4E",
      "Success": true
    }
  • XML format
    <? xml version="1.0" encoding="UTF-8"? >
     <QueryThingModelResponse>
          <Data>
            <ThingModelJson>{\"productKey\":\"a1bPo9p****\",\"_ppk\":{},\"properties\":[{\"identifier\":\"SimCardType\",\"dataSpecs\":{\"max\":\"1\",\"dataType\":\"INT\",\"unit\":\"mmHg\",\"min\":\"0\",\"step\":\"1\"},\"std\":false,\"custom\":true,\"dataType\":\"INT\",\"rwFlag\":\"READ_ONLY\",\"configCode\":\"03F7B23CD285458AB191E0881F889BE91579420094360\",\"productKey\":\"a1Jw4idFWHX\",\"required\":false,\"customFlag\":true,\"dataSpecsObject\":{\"unit\":\"mmHg\",\"min\":\"0\",\"max\":\"1\",\"dataType\":\"INT\",\"step\":\"1\"},\"name\":\"simCardType\",\"extendConfig\":\"{\\\"originalDataType\\\":{\\\"specs\\\":{\\\"registerCount\\\":1,\\\"reverseRegister\\\":0,\\\"swap16\\\":0},\\\"type\\\":\\\"bool\\\"},\\\"identifier\\\":\\\"SimCardType\\\",\\\"registerAddress\\\":\\\"0x03\\\",\\\"scaling\\\":1,\\\"writeFunctionCode\\\":0,\\\"operateType\\\":\\\"inputStatus\\\",\\\"pollingTime\\\":1000,\\\"trigger\\\":1}\"}],\"services\":[],\"events\":[]}</ThingModelJson>
          </Data>
          <RequestId>C4FDA54C-4201-487F-92E9-022F42387458</RequestId>
          <Success>true</Success>
     </QueryThingModelResponse>