Imports a TSL for a specified product.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to ImportThingModelTsl.
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.

TslStr String Yes The TSL to be edited. It is a JSON string. The TSL defines the properties, services, and events of the product.

The format of TslStr must be the same as the standard TSL data format. For more information, see Overview.

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 information about error codes, see Error codes.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=ImportThingModelTsl
&ProductKey=a1lWSUw****
&TslStr={\"profile\":{\"productKey\": \"a1bPo9p****\"},\"services\":[],\"properties\":[],\"events\":[]}
&<Common request parameters>

Sample responses

  • JSON format
    {
      "RequestId": "9E76053E-26ED-4AB4-AE58-8AFC3F1E7E8E",
      "Success": true
    }
  • XML format
    <? xml version="1.0" encoding="UTF-8" ? >
    <ImportThingModelTslResponse>
        <RequestId>9E76053E-26ED-4AB4-AE58-8AFC3F1E7E8E</RequestId>
        <Success>true</Success>
    </ImportThingModelTslResponse>