Creates a product.
Limits
Each Alibaba Cloud account can run a maximum of 50 queries per second (QPS).
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateProduct |
The operation that you want to perform. Set the value to CreateProduct. |
NodeType | Integer | Yes | 0 |
The node type of the product. Valid values: 0: device. Sub-devices cannot be attached to a device. A device can connect to IoT Platform directly or as a sub-device of a gateway. 1: gateway. Sub-devices can be attached to a gateway. A gateway can manage sub-devices, maintain the topological relationships with sub-devices, and synchronize the topological relationships to IoT Platform. |
ProductName | String | Yes | Light |
The name of the product. The name must be 4 to 30 characters in length and can contain letters, digits, and underscores (_). Note Each product name must be unique within the current account.
|
IotInstanceId | String | No | iot_instc_pu****_c*-v64******** |
The ID of the instance. This parameter is not required for the public instance but required for Enterprise Edition instances. |
DataFormat | Integer | No | 1 |
The data format. Valid values:
|
Description | String | No | Product test |
The description of the product. The description must be 1 to 100 characters in length. |
AliyunCommodityCode | String | No | iothub_senior |
The edition of the product. You can create products only for which the Thing Specification Language (TSL) model feature is enabled. Set the value to iothub_senior. |
Id2 | Boolean | No | false |
Specifies whether to enable IoT Internet Device ID. Valid values:
Default value: false Note IoT Internet Device ID is available only in the China (Shanghai) region. If the Id2
parameter is set to true but the AuthType parameter is not set to id2, the value of the AuthType parameter is used.
|
CategoryId | Long | No | 1 |
A reserved parameter. You do not need to specify this parameter. |
ProtocolType | String | No | modbus |
The protocol that the devices of the product use to connect to gateways. You must specify this parameter if the AliyunCommodityCode parameter is set to iothub_senior and a gateway is required to connect the devices of the product to IoT Platform. Valid values:
|
NetType | String | No | WIFI |
The network connection method. You must specify this parameter if the AliyunCommodityCode parameter is set to iothub_senior and the devices of the product are directly connected to IoT Platform. Valid values:
Default value: WIFI |
JoinPermissionId | String | No | 8*** |
The ID of the network access credential. This parameter is required if the NetType parameter is set to LORA. If you do not have a credential, log on to the Alibaba Cloud Link WAN console to apply for one. |
ResourceGroupId | String | No | rg-acfmxazb4ph**** |
The ID of the resource group to which the product belongs. If this parameter is specified, new products are added to the resource group. You can log on to the Resource Management console to view the ID of the resource group. |
AuthType | String | No | secret |
The authentication method that is used to connect the devices of the product to IoT Platform. Valid values:
Default value: secret |
CategoryKey | String | No | Lighting |
The identifier of the product category. If you specify this parameter, a TSL model of the category is used. Otherwise, no TSL model is used. You can call the ListThingTemplates operation to query the details of categories that are predefined by IoT Platform. |
PublishAuto | Boolean | No | false |
Specifies whether to publish the TSL model after the product is created.
Default value: true |
ValidateType | Integer | No | 1 |
The level of the data verification. If you do not specify this parameter, a low-level verification is performed by default. Valid values:
|
In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | 200 |
The error code returned if the call fails. For more information, see Error codes. |
Data | Struct |
The product information returned if the call is successful. |
|
AliyunCommodityCode | String | iothub_senior |
The edition of the product.
|
AuthType | String | secret |
The authentication method that was used to connect the devices of the product to IoT Platform. Valid values:
|
DataFormat | Integer | 1 |
The format of the response data.
Note This parameter is available if the AliyunCommodityCode parameter is set to iothub_senior.
|
Description | String | Product test |
The description of the product. |
Id2 | Boolean | false |
Indicates whether IoT Internet Device ID was enabled.
|
NodeType | Integer | 0 |
The node type of the product. Valid values:
Note This parameter is available if the AliyunCommodityCode parameter is set to iothub_senior.
|
ProductKey | String | a1FlqIQ**** |
The ProductKey of the product. A ProductKey is a globally unique identifier (GUID) that is issued by IoT Platform to a new product. Note Keep the ProductKey confidential. The ProductKey is required when you perform some
operations.
|
ProductName | String | Test |
The name of the product. |
ProductSecret | String | U5tW7i44uilc**** |
The ProductSecret of the product. |
ProtocolType | String | modbus |
The protocol that the devices of the product use to connect to gateways. Note This parameter is available if the AliyunCommodityCode parameter is set to iothub_senior.
|
ErrorMessage | String | A system exception occurred. |
The error message returned if the call fails. |
ProductKey | String | a1FlqIQ**** |
The ProductKey of the product. The ProductKey is the unique identifier that is issued by IoT Platform to the product. |
RequestId | String | E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565 |
The ID of the request. |
Success | Boolean | true |
Indicates whether the call was successful.
|
Examples
Sample requests
https:/iot.cn-shanghai.aliyuncs.com/? Action=CreateProduct
&AliyunCommodityCode=iothub_senior
&AuthType=secret
&DataFormat=1
&Description=Product test
&NodeType=0
&ResourceGroupId=rg-acfmxazb4ph****
&ProductName=Test
&ProtocolType=modbus
&CategoryKey=Lighting
&PublishAuto=false
&<Common request parameters>
Sample success responses
XML
format
<CreateProductResponse>
<Data>
<Description>Product test</Description>
<DataFormat>1</DataFormat>
<ProtocolType>modbus</ProtocolType>
<ProductKey>a1FlqIQ****</ProductKey>
<ProductSecret>U5tW7i44uilc****</ProductSecret>
<NodeType>0</NodeType>
<ProductName>Test</ProductName>
<AliyunCommodityCode>iothub_senior</AliyunCommodityCode>
<AuthType>secret</AuthType>
<ResourceGroupId>rg-acfmxazb4ph****</ResourceGroupId>
</Data>
<ProductKey>a1FlqIQ****</ProductKey>
<RequestId>E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565</RequestId>
<Success>true</Success>
</CreateProductResponse>
JSON
format
{
"Data": {
"Description": "Product test",
"DataFormat": 1,
"ProtocolType": "modbus",
"ProductKey": "a1FlqIQ****",
"ProductSecret": "U5tW7i44uilc****",
"NodeType": 0,
"ProductName": "Test",
"AliyunCommodityCode": "iothub_senior",
"AuthType": "secret",
"ResourceGroupId": "rg-acfmxazb4ph****"
},
"ProductKey": "a1FlqIQ****",
"RequestId": "E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565",
"Success": true
}
Error codes
For a list of error codes, visit the API Error Center.