Queries products by tag.

Limits

  • Each Alibaba Cloud account can run a maximum of 500 queries per second (QPS).
    Note RAM users of an Alibaba Cloud account share the quota of the account.
  • You can specify a tag key or a tag key-value pair for search.
  • If you specify multiple tags, the logical relationship among these tags is OR.

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 ListProductByTags

The operation that you want to perform. Set the value to ListProductByTags.

ProductTag.N.TagKey String Yes room

The keys of the product tags.

IotInstanceId String No iot_instc_pu****_c*-v64********

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

Notice
  • If your instance has an ID, you must configure this parameter. If you do not set this parameter, the call fails.
  • If your instance has no Overview page or ID, you do not need to set this parameter.

For more information, see Overview.

CurrentPage Integer No 1

The number of the page to return.

PageSize Integer No 10

The number of entries to return on each page. Maximum value: 50.

ProductTag.N.TagValue String No 102

The values of the product tags.

In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information, see Common request parameters.

Response parameters

Parameter Type Example Description
Code String iot.system.SystemException

The error code returned if the call fails. For more information, see Error codes.

ErrorMessage String A system exception occurred.

The error message returned if the call fails.

ProductInfos Array of ProductInfo

The details of the products returned if the call is successful. The details are included in the ProductInfo parameter.

Note The returned product information is sorted in reverse-chronological order based on the time when the products were created.
ProductInfo
CreateTime Long 1545355537000

The time when the product was created.

Description String This is a test product.

The description of the product.

NodeType Integer 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.
ProductKey String a1BwAGV****

The ProductKey of the product. A ProductKey is a globally unique identifier (GUID) issued by IoT Platform to a new product.

ProductName String Street light

The name of the product.

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

The ID of the request.

Success Boolean true

Indicates whether the call was successful.

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

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=ListProductByTags
&CurrentPage=1
&PageSize=10
&ProductTag.1.TagKey=Reen
&ProductTag.1.TagValue=reen
&ProductTag.2.TagKey=Lock
&ProductTag.2.TagValue=1234
&<Common request parameters>

Sample success responses

XML format

<ListProductByTagsResponse>
  <RequestId>09AA366E-81EC-4CF0-B49E-61BCD7C95338</RequestId>
  <Success>true</Success>
  <ProductInfos>
        <ProductInfo>
              <ProductKey>a1BwAGV****</ProductKey>
              <NodeType>0</NodeType>
              <CreateTime>1581595942000</CreateTime>
              <ProductName>Street light</ProductName>
        </ProductInfo>
        <ProductInfo>
              <ProductKey>a1PO***</ProductKey>
              <NodeType>0</NodeType>
              <CreateTime>1580898565000</CreateTime>
              <ProductName>Sensor </ProductName>
        </ProductInfo>
  </ProductInfos>
</ListProductByTagsResponse>

JSON format

{
    "RequestId": "09AA366E-81EC-4CF0-B49E-61BCD7C95338",
    "Success": true,
    "ProductInfos": {
        "ProductInfo": [
            {
                "ProductKey": "a1BwAGV****",
                "NodeType": 0,
                "CreateTime": 1581595942000,
                "ProductName": "Street light"
            },
            {
                "ProductKey": "a1PO***",
                "NodeType": 0,
                "CreateTime": 1580898565000,
                "ProductName": "Sensor"
            }
        ]
    }
}

Error codes

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