Adds Thing Specification Language (TSL) features for a specified product.

Limits

You can call this operation to add a maximum of 10 features. 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 CreateThingModel.
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 retrieve the value of the ProductKey parameter.

ThingModelJson String Yes The details of the new features.
Note
  • You can specify a maximum of 10 features per query.
  • 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:
    {
      "properties":[
        {
          "identifier": "SimCardType",
          "dataSpecs": {
            "max": "1",
            "dataType": "INT",
            "unit": "mmHg",
            "min": "0",
            "step": "1"
          },
          "std": false,
          "custom": true,
          "dataType": "INT",
          "rwFlag": "READ_ONLY",
          "productKey": "a1bPo9p****",
          "required": false,
          "customFlag": true,
          "name": "sim card type"
        }
      ],
      "services":[...],
      "events":[...]
    }
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=CreateThingModel
&ProductKey=a1bPo9p****
&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": "a1bPo9p****","required": false,"customFlag": true, "name": "sim card type"}]}
&<Common request parameters>

Sample responses

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