All Products
Search
Document Center

IoT Platform:QueryProductList

Last Updated:Nov 29, 2023

Queries all products.

Usage notes

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
}

QPS limits

  • You can call this operation up to 50 times per second per account.

    Note

    The RAM users of an Alibaba Cloud account share the quota of the account.

  • If the product of the value of CurrentPage and the value of PageSize is greater than or equal to 100,000, the QPS of this operation decreases.

    In this case, each Alibaba Cloud account can run up to 2 QPS.

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

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.

IotInstanceId

String

No

iot_instc_pu****_c*-v64********

The ID of the instance. You can view the ID of the instance on the Overview tab in the IoT Platform console.

Important
  • If your instance has an ID, you must specify the ID for this parameter. Otherwise, the call fails.

  • If your instance does not have an ID, you do not need to configure the parameter.

For more information, see Overview.

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:

  • iothub_senior: A Thing Specification Language (TSL) model is used for the product.

  • iothub: No TSL model is used for the product.

Note

If you do not specify this parameter, all products are returned.

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.

Response 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:

  • secret: DeviceSecrets were used to verify the devices.

  • id2: IoT Device ID was used to verify the devices.

  • x509: X.509 certificates were used to verify the devices.

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:

  • 0: custom. A custom serial data format is used. In this case, the devices can submit raw data, such as binary data streams. IoT Platform converts the raw data into standard Alink JSON data by using a specific data parsing script.

  • 1: Alink JSON. Alink JSON data is transmitted between the devices and IoT Platform. Alink is a data exchange protocol that is predefined in IoT Platform.

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:

  • 0: device. Sub-devices cannot be attached to a device. A device can be directly connected to IoT Platform or connected to IoT Platform as a sub-device of a gateway.

  • 1: gateway. Sub-devices can be attached to a gateway. A gateway can manage sub-devices, maintain topological relationships with sub-devices, and synchronize topological relationships to IoT Platform.

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:

  • true: The call was successful.

  • false: The call failed.

Examples

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
}

Error codes

For a list of error codes, see Service error codes.