Queries all products.
If the value that you specified for CurrentPage is greater than the value of PageCount when you call the QueryProductList operation, ProductInfo is empty. In this case, you can specify new values for CurrentPage and PageSize based on the return value of Total and call the QueryProductList operation to query products again.
For example, if the return value of Total is 20 and the value that you specified for PageSize is 5, the return value of PageCount is 4. The result is calculated by using the following formula: 20/5 = 4. If you specify 1, 2, 3, or 4 for CurrentPage, ProductInfo is not empty. If you specify a value that is greater than 4 for CurrentPage, for example, 5, ProductInfo is empty because no data exists on Page 5.
Sample success response:
{
"RequestId": "62F56B4D-9CBC-518A-8414-CC91BB83FD04",
"Data": {
"PageCount": 4,
"PageSize": 5,
"CurrentPage": 5,
"Total": 20,
"List": {
"ProductInfo": []
}
},
"Code": "",
"Success": true
}
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | QueryProductList | The operation that you want to perform. Set the value to QueryProductList. |
| CurrentPage | Integer | Yes | 1 | The page number. |
| PageSize | Integer | Yes | 2 | The number of entries per page. Valid values: 1 to 200. |
| ResourceGroupId | String | No | rg-acfmxazb4ph**** | The resource group ID. Important IoT Platform allows you to add only instances to a resource group. ResourceGroupId parameter no longer takes effect. You do not need to configure ResourceGroupId. |
| AliyunCommodityCode | String | No | iothub_senior | The type of the product. Valid values:
|
In addition to the preceding operation-specific request parameters, you must configure common request parameters when you call this operation. For more information about common request parameters, see Common parameters.
| Parameter | Type | Example | Description |
|---|---|---|---|
| Code | String | iot.system.SystemException | The error code returned if the request fails. For more information, see Error codes. |
| Data | Struct | The product information returned if the call is successful. For more information, see the following parameters. | |
| CurrentPage | Integer | 1 | The page number. |
| List | Array of ProductInfo | The queried products. Note The queried products are sorted in reverse chronological order based on the time when the products were created. |
|
| ProductInfo | |||
| AuthType | String | secret | The verification method that is used to connect the devices of the product to IoT Platform. Valid values:
|
| DataFormat | Integer | 1 | The data format that is used by a communication protocol to transmit data between the devices and IoT Platform. This parameter is returned only if AliyunCommodityCode is set to iothub_senior. Valid values:
|
| Description | String | This is a test product. | The description of the product. |
| DeviceCount | Integer | 128 | The number of devices in the product. |
| GmtCreate | Long | 1581595942000 | The time when the product was created. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 Coordinated Universal Time (UTC). |
| NodeType | Integer | 0 | The node type of the product. This parameter is returned only if AliyunCommodityCode is set to iothub_senior. Valid values:
|
| ProductKey | String | a1T27vz**** | The ProductKey of the product. A ProductKey is a globally unique identifier (GUID) that is issued by IoT Platform to a product. |
| ProductName | String | Street light | The name of the product. |
| PageCount | Integer | 92 | The total number of pages returned. |
| PageSize | Integer | 2 | The number of entries per page. |
| Total | Integer | 184 | The total number of products. |
| ErrorMessage | String | A system exception occurred. | The error message returned if the call fails. |
| RequestId | String | 4B4ECF2C-6222-42EC-A4B5-C12202E71CEA | The ID of the request. |
| Success | Boolean | true | Indicates whether the call was successful. Valid values:
|
Sample requests
https://iot.cn-shanghai.aliyuncs.com/?Action=QueryProductList
&CurrentPage=1
&PageSize=2
&ResourceGroupId=rg-acfmxazb4ph****
&<Common request parameters>
Sample success responses
XML format
<QueryProductListResponse>
<Data>
<PageCount>92</PageCount>
<PageSize>2</PageSize>
<List>
<ProductInfo>
<DataFormat>1</DataFormat>
<ProductKey>a1A0D4t****</ProductKey>
<NodeType>0</NodeType>
<ProductName>Street light</ProductName>
<DeviceCount>1</DeviceCount>
<GmtCreate>1569233025000</GmtCreate>
<AuthType>secret</AuthType>
</ProductInfo>
<ProductInfo>
<DataFormat>1</DataFormat>
<ProductKey>a1dEvuQ****</ProductKey>
<NodeType>0</NodeType>
<ProductName>Custom sub-device</ProductName>
<DeviceCount>0</DeviceCount>
<GmtCreate>1568690432000</GmtCreate>
<AuthType>secret</AuthType>
</ProductInfo>
</List>
<CurrentPage>1</CurrentPage>
<Total>184</Total>
</Data>
<RequestId>4B4ECF2C-6222-42EC-A4B5-C12202E71CEA</RequestId>
<Success>true</Success>
</QueryProductListResponse>
JSON format
{
"Data": {
"PageCount": 92,
"PageSize": 2,
"List": {
"ProductInfo": [
{
"DataFormat": 1,
"ProductKey": "a1A0D4t****",
"NodeType": 0,
"ProductName": "Street light",
"DeviceCount": 1,
"GmtCreate": 1569233025000,
"AuthType": "secret"
},
{
"DataFormat": 1,
"ProductKey": "a1dEvuQ****",
"NodeType": 0,
"ProductName": "Custom sub-device",
"DeviceCount": 0,
"GmtCreate": 1568690432000,
"AuthType": "secret"
}
]
},
"CurrentPage": 1,
"Total": 184
},
"RequestId": "4B4ECF2C-6222-42EC-A4B5-C12202E71CEA",
"Success": true
}