Call this operation to create a product.

Request parameters

Parameter Type Required Description
Action String  Yes The operation that you want to perform. Set the value to CreateProduct.
ProductName String  Yes The name of the product. A product name can be 4 to 30 characters in length and can contain Chinese characters, English letters, digits, and underscores (_).
Note A product name must be unique in an account.
NodeType Integer Yes

The node type of the product. Values:

0: Device. A device cannot be mounted with sub-devices. It can connect to IoT Platform either directly or as a sub-device of a gateway.

1: Gateway. A gateway can be mounted with sub-devices. It can manage sub-devices, maintain the topological relationships with sub-devices, and synchronize the topological relationships to IoT Platform.

AliyunCommodityCode  String  No The edition of the product that you want to create. There are two options:
  • iothub_senior: Pro Edition.
  • iothub: Basic Edition.

If you do not input this parameter, the default value is used, which is iothub (Basic Edition).

DataFormat Integer Yes You must specify this parameter if the value of AliyunCommodityCode is iothub_senior.

This parameter is only available and required when you create a Pro Edition product.

Options:

  • 0: Do not parse/Custom.
  • 1: Alink JSON.
Description  String  No A description of the product. The description can be a maximum of 100 characters in length.
ProtocolType  String  No The protocol that devices of this product use to connect to gateways.

Set this parameter only if you are creating a product whose devices will be connected to gateways.

Options:

  • modbus: Modbus.
  • opc-ua: OPC UA.
  • customize: Customized protocol.
  • ble: BLE.
  • zigbee: ZigBee.
NetType  String  No Networking mode.

Set this parameter only if you are creating a product whose devices directly connect to IoT Platform.

Options:

  • WIFI
  • CELLULAR
  • ETHERNET
  • OTHER

The default value is WIFI.

Common request parameters - No For more information about common request parameters, 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 is successful. A value of true indicates that the call is successful. A value of false indicates that the call has failed.
ErrorMessage  String The error message returned when the call fails.
Code  String The error code returned when the call fails. For more information about error codes, see Error codes.
ProductKey  String The globally unique identifier of the product issued by IoT Platform.
Data Data The information of the created product that is returned when the call is successful. See Table 1.
Table 1. ProductInfo
Parameter Type Description
ProductName  String The name of the product.
ProductKey  String The globally unique identifier of the product issued by IoT Platform .
Note Keep the value of ProductKey confidential. The ProductKey value is required in other operations related to the product and its devices.
Description  String The description of the product.
DataFormat Integer The data type of the product.
  • 0: Do not parse/Custom.
  • 1: Alink JSON.

This parameter is only available for Pro Edition products.

AliyunCommodityCode  String The product edition.
  • iothub_senior: Pro Edition.
  • iothub: Basic Edition.
ProtocolType  String The protocol that devices of this product use to connect to a gateway.

This parameter is only available for Pro Edition products.

NodeType Integer

The node type of the product. Values include:

0: Device. A device cannot be mounted with sub-devices. This kind of devices can connect to IoT Platform directly or as sub-devices of gateway devices.

1: Gateway. A gateway can be mounted with sub-devices. It can manage sub-devices, maintain the topological relationships with sub-devices, and synchronize the topological relationships to IoT Platform.

This parameter is only available for Pro Edition products.

Examples

Request example

https://iot.cn-shanghai.aliyuncs.com/?Action=CreateProduct
&AliyunCommodityCode=iothub_senior
&DataFormat=1
&Description=Product test
&NodeType=0
&ProductName=Test
&ProtocolType=modbus
&Common request parameters

Response example

  • JSON format
    {
          RequestId:8AE93DAB-958F-49BD-BE45-41353C6DEBCE,
          Success:true,
          ProductKey:a1QDKAU****,	  
          Data:{
              ProductKey:a1QDKAU****, 
              DataFormat:1, 
    	  NodeType:0,
              ProtocolType:modbus,
              ProductName:Test,
    	  Description:Product test,
              AliyunCommodityCode:iothub_senior
          }
      }      }
      }
  • XML format
    <? xml version="1.0" encoding="UTF-8"? > 
      <CreateProductResponse>
          <RequestId>8AE93DAB-958F-49BD-BE45-41353C6DEBCE</RequestId>
          <ProductKey>a1QDKAU****</ProductKey>
          <Data>
             <Description>Product test</Description>
             <DataFormat>1</DataFormat>
             <ProductKey>a1QDKAU****</ProductKey>
             <ProtocolType>modbus</ProtocolType>
             <NodeType>0</NodeType>
             <ProductName>Test</ProductName>
             <AliyunCommodityCode>iothub_senior</AliyunCommodityCode>
          </Data>
          <Success>true</Success>
      </CreateProductResponse>