Search Product¶
Search for products based on the search criteria.
Operation Permissions¶
Required Authorization |
Required Operation Permission |
---|---|
Device Management |
Read |
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:
|
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 |
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":{},
"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":{},
"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
}
}
Java SDK Sample¶
package com.envisioniot.enos.api.sample.connect_service.product;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envisioniot.enos.api.common.constant.request.Pagination;
import com.envisioniot.enos.api.common.constant.request.Projection;
import com.envisioniot.enos.connect_service.v2_1.product.SearchProductRequest;
import com.envisioniot.enos.connect_service.v2_1.product.SearchProductResponse;
public class SearchProduct {
public static void main(String[] args) {
String appKey = "yourAppKey";
String appSecret = "yourAppSecret";
String serverUrl = "yourServerUrl";
String orgId = "yourOrgId";
SearchProductRequest request = new SearchProductRequest();
request.setOrgId(orgId);
request.setExpression("modelId='yourModelId'"); // or productKey = 'yourProductKey'
request.setPagination(new Pagination(5, 1, null));
Projection projection = new Projection();
projection.add("productName");
request.setProjection(projection);
SearchProductResponse response = Poseidon.config(PConfig.init().appKey(appKey).appSecret(appSecret).debug())
.url(serverUrl)
.getResponse(request, SearchProductResponse.class);
}
}