V2.1 Search Product

Search for products based on the search criteria.


This API is available in EnOS 2.1.0 and above. Version 2.4 has been added and it is recommended to use V2.4 Search Product.

If you need to invoke this API after performing bulk updates to relevant products using other APIs, it is recommended to wait for about 2 seconds to avoid obtaining unupdated data.

Request Format

POST https://{apigw-address}/connect-service/v2.1/products?action=search

Request Parameters (URI)

Name Location (Path/Query) Mandatory/Optional Data Type Description
orgId Query Mandatory String The organization ID which the asset belongs to. How to get orgId>>

Request Parameters (Body)

Name Mandatory/Optional Data Type Description
expression Optional String

The query expression, which supports sql-like query. The fields that are supported for query include: productKey, modelId, productTags and productName . The supported arithmetic operators are “=” and “in”, and the logical operator is “and” and “or”.

  • productKey : supports arithmetic operators “=” and “in”

  • modelId : supports arithmetic operators “=” and “in”

  • productTags: supports arithmetic operators “=”, “exists”, and “not exists”

  • productName supports fuzzy inquiry of specified language:

    • productName like 'xxx': fuzzy inquiry of default name, Chinese name, and English name
    • productName.default like 'xxx': fuzzy inquiry of default name
    • productName.zh_CN like 'xxx': fuzzy inquiry of Chinese name, if no Chinese name, fuzzy inquiry of default name
    • productName.en_US like 'xxx': fuzzy inquiry of English name, if no English name, fuzzy inquiry of default name

How to use expression>>

pagination Optional Pagination Request Struct Lists the paging requirements in a request. When not specified, 10 records are displayed per page by default and sorted in descending order by createTime. The maximum records per page is 1,000 but for optimal performance, it is recommended to have not more than 50 records per page. sorters is not supported to sort the response. For more details, see Pagination Request Struct>>

Response Parameters

Name Data Type Description
data Array of Product Structs A list of the products returned. For details of a Product Struct, see Product Struct.

Samples

Request Sample

url: https://{apigw-address}/connect-service/v2.1/products?action=search&orgId=yourOrgId
method: POST
requestBody:
{
    "expression":"modelId=\"AlterTest0615\"",
    "pagination":{
        "pageNo":1,
        "pageSize":5
    }
}

Return Sample

{
    "code":0,
    "msg":"OK",
    "requestId":"a82752bb-9eb0-4cd5-b0c6-0c1aeb35f6d2",
    "data":[
        {
            "orgId":"yourOrgId",
            "productKey":"yourProductKey",
            "productName":{
                "defaultValue":"openapi_sdk_8",
                "i18nValue":{}
            },
            "productSecret":"yourProductSecret",
            "productDesc":"test_sdk_update",
            "productType":"Device",
            "dataFormat":"Custom",
            "productTags":{},
      "protocolGatewayIds":{},
            "modelId":"AlterTest0615",
            "dynamicActiveEnabled":false,
            "biDirectionalAuth":true,
      "createBy": null,
      "createTime": null,
      "updateBy": null,
      "updateTime": 1589767858113
        },
        {
            "orgId":"yourOrgId",
            "productKey":"yourProductKey",
            "productName":{
                "defaultValue":"AlterTest0615_Product",
                "i18nValue":{}
            },
            "productSecret":"yourProductSecret",
            "productDesc":"",
            "productType":"Device",
            "dataFormat":"Json",
            "productTags":{},
      "protocolGatewayIds":{},
            "modelId":"AlterTest0615",
            "dynamicActiveEnabled":false,
            "biDirectionalAuth":false,
      "createBy": null,
      "createTime": null,
      "updateBy": null,
      "updateTime": 1589767858113,
      "defaultValidDay":null,
      "maxValidDay":null
        }
    ],
    "pagination":{
        "sortedBy":null,
        "pageNo":1,
        "pageSize":5,
        "totalSize":2
    }
}

SDK Samples


You can access the SDK samples for Connection Service on GitHub: