Creates a product.

Limits

Each Alibaba Cloud account can run a maximum of 50 queries per second (QPS).

Note RAM users share the quota of the Alibaba Cloud account.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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 mounted on a device. A device can connect to IoT Platform directly or as a sub-device of a gateway.

1: gateway. Sub-devices cannot be mounted on 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 for the Alibaba Cloud account.
IotInstanceId String No iot_instc_pu****_c*-v64********

The ID of the IoT instance. This parameter is not required for public instances, but required for the instances that you have purchased.

DataFormat Integer No 1

The format of the request data.

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

Valid values:

  • 0: Do not parse/Custom
  • 1: Alink JSON
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.

  • iothub_senior: A Thing Specification Language (TSL) model is required. The DataFormat parameter must be specified.
  • iothub: A TSL model is not required.

By default, the edition of the product is iothub and a TSL model is not required.

Id2 Boolean No false

Specifies whether to enable IoT Internet Device ID.

Valid values:

  • false: disables IoT Internet Device ID.
CategoryId Long No 1

N/A

ProtocolType String No modbus

The protocol that the devices of the product use to connect to gateways.

You must specify this parameter if the value of AliyunCommodityCode is iothub_senior and a gateway is required to connect the devices to IoT.

Valid values:

  • modbus: Modbus
  • opc-ua: OPC UA
  • customize: custom protocol
  • ble: BLE
  • zigbee: ZigBee
NetType String No Wi-Fi

Networking mode.

You must specify this parameter if the value of AliyunCommodityCode is iothub_senior and the devices of the product are directly connected to IoT Platform.

Valid values:

  • WIFI
  • CELLULAR
  • ETHERNET
  • OTHER

The default value is WIFI.

JoinPermissionId String No 8***

The ID of the network access credential. This parameter is required if the NetType parameter is set to LORA.

ResourceGroupId String No rg-acfmxazb4ph****

The ID of the resource group to which the product belongs. If this parameter is specified, new products are assigned to the resource group.

You can log on to the Resource Management console to query 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:

The default value is 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 information of the predefined category.

PublishAuto Boolean No false

Specifies whether to publish the TSL model after the product is created.

  • true: The TSL model is published after the product is created.
  • false: The TSL model is not published after the product is created.

The default value is true.

In addition to the preceding request parameters, you must also specify common request parameters when you call this API 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 returned information of the created product if the call is successful.

AliyunCommodityCode String iothub_senior

The edition of the product.

  • iothub_senior: A TSL model was used.
  • iothub: A TSL model was not used.
AuthType String secret

The authentication method that was used to connect the devices of the product to IoT Platform. Valid values:

  • secret: indicates that the device secret was used as the authentication method.
DataFormat Integer 1

The format of the response data.

  • 0: Do not parse/Custom.
  • 1: Alink JSON.
Note This parameter is specified only when the value of AliyunCommodityCode is iothub_senior.
Description String Product test

The description of the product.

Id2 Boolean false

Indicates whether IoT Internet Device ID was enabled.

  • false: IoT Internet Device ID was disabled.
NodeType Integer 0

The node type of the product. Valid values:

  • 0: device. Sub-devices cannot be mounted on a gateway. A device can connect to IoT Platform directly or as a sub-device of a gateway.
  • 1: gateway. Sub-devices cannot be mounted on a gateway. A gateway can manage sub-devices, maintain the topological relationships with sub-devices, and synchronize the topological relationships to IoT Platform.
Note This parameter is specified only when the value of AliyunCommodityCode is iothub_senior.
ProductKey String a1FlqIQ****

The globally unique identifier of the product. This identifier is issued by IoT Platform.

Note The product key must be backed up because it may be required when you perform other operations.
ProductName String Test

The name of the product.

ProductSecret String U5tW7i44uilc****

The secret of the product.

ProtocolType String modbus

The protocol that the devices of the product used to connect to gateways.

Note This parameter is specified only when the value of AliyunCommodityCode is iothub_senior.
ErrorMessage String A system exception has occurred.

The error message returned if the call failed.

ProductKey String a1FlqIQ****

The key of the product to which the devices belong. This key is a unique identifier that is allocated by IoT Platform for the product.

RequestId String E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565

The globally unique identifier generated by IoT Platform for the request.

Success Boolean True

Indicates whether the request was successful.

  • true: The call was successful.
  • false: The call failed.

Examples

Sample requests

http(s)://iot.cn-shanghai.aliyuncs.com/? Action=CreateProduct
&AliyunCommodityCode=iothub_senior
&AuthType=secret
&DataFormat=1
&Description=modidyTest
&NodeType=0
&ResourceGroupId=rg-acfmxazb4ph****
&productName=dts
&ProtocolType=NFS
&CategoryKey=Lighting
&PublishAuto=false
&<Common request parameters>

Sample success responses

XML format

<CreateProductResponse>
      <Data>
            <Description>drds_test</Description>
            <DataFormat>1</DataFormat>
            <ProtocolType>NFS</ProtocolType>
            <ProductKey>a19mzPZ****</ProductKey>
            <ProductSecret>U5tW7i44uilc****</ProductSecret>
            <NodeType>0</NodeType>
            <ProductName>Product name</ProductName>
            <AliyunCommodityCode>iothub_senior</AliyunCommodityCode>
            <AuthType>APP</AuthType>
            <ResourceGroupId>rg-acfmxazb4ph****</ResourceGroupId>
      </Data>
      <ProductKey>a19mzPZ****</ProductKey>
      <RequestId>E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565</RequestId>
      <Success>true</Success>
</CreateProductResponse>

JSON format

{
  "Data": {
    "Description":"drds_test",
    "DataFormat": 1,
    "ProtocolType": "NFS",
    "ProductKey": "a19mzPZ****",
    "ProductSecret": "U5tW7i44uilc****",
    "NodeType": 0,
    "ProductName": "VPC",
    "AliyunCommodityCode":"iothub_senior"
    "AuthType": "secret",
    "ResourceGroupId": "rg-acfmxazb4ph****",
  },
  "ProductKey": "a19mzPZ****",
  "RequestId": "E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565",
  "Success": true
}

Error codes

For a list of error codes, visit the API Error Center.