Updates a Thing Specification Language (TSL) feature of a specified product.

Limits

You can call this operation to update only one feature. TSL features include properties, services, and events.

Request parameters

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

ThingModelJson String Yes The updated details of the feature.
Note
  • You can specify only one feature.
  • For information about how to specify the ThingModelJson parameter, see the data formats of properties, services, and events in the Data structure of ThingModelJson topic.
    Example value of the ThingModelJson parameter that is used to update a property:
    {
      "properties":[
        {
          "identifier": "SimCardType",
          "dataSpecs": {
            "max": "1",
            "dataType": "INT",
            "unit": "mmHg",
            "min": "0",
            "step": "1"
          },
          "std": false,
          "custom": true,
          "dataType": "INT",
          "rwFlag": "READ_ONLY",
          "productKey": "a1Jw4i****",
          "required": false,
          "customFlag": true,
          "name": "sim card type"
        }
      ]
    }
Identifier String Yes The identifier of the feature.

To update a feature, you must specify the identifier of the feature. You can call the GetThingModelTsl operation to query the identifier. The identifier parameter is included in the TslStr response parameter.

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.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=UpdateThingModel
&ProductKey=a1Jw4id****
&ThingModelJson={"properties":[{"identifier": "SimCardType","dataSpecs": {"max": "1", "dataType": "INT","unit": "mmHg","min": "0","step": "1"},"std": false,"custom": true,"dataType": "INT","rwFlag": "READ_ONLY","productKey": "a1Jw4id****","required": false,"customFlag": true, "name": "sim card type"}]}
&Identifier=SimCardType
&<Common request parameters>

Sample responses

  • JSON format
    {
      "RequestId": "5573D217-8E3E-47AD-9331-2083B88E64B2",
      "Success": true
    }
  • XML format
    <? xml version="1.0" encoding="UTF-8" ? >
    <UpdateThingModelResponse>
        <RequestId>5573D217-8E3E-47AD-9331-2083B88E64B2</RequestId>
        <Success>true</Success>
    </UpdateThingModelResponse>