V2.4 Search Product

Search for products based on the search criteria.


This API is only available if 2.4 Cumulative Update 1 has been applied to your environment.

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.4/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>>

requireSecret Optional Boolean
  • true: productSecret and sessionKey will be returned. Ensure that:
    • Your service account has been granted with the required permission. If not, the returned value of productSecret and sessionKey will be an error.
    • The RSA key pair has been created for the service account. Creating RSA Key Pairs >>
  • false (default): productSecret and sessionKey will not be returned.
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.

Error Codes

Code Message Description
99400 Invalid arguments One or multiple parameters are invalid.
11858 Unable to find public key Unable to find public key for requireSecret due to there is no RSA key pair for the service account. Creating RSA Key Pairs >>.

Samples

Request Sample

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

Return Sample


{
    "code":0,
    "msg":"OK",
    "requestId":"a82752bb-9eb0-4cd5-b0c6-0c1aeb35f6d2",
    "data":[
        {
            "orgId":"yourOrgId",
            "productKey":"yourProductKey",
            "productName":{
                "defaultValue":"openapi_sdk_8",
                "i18nValue":{}
            },
            "productSecret"::"EncryptedProductSecret1",
            "sessionKey":"EncryptedSessionKey1",
            "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":"EncryptedProductSecret2",
            "sessionKey":"EncryptedSessionKey2",
            "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: