Search Alert Content¶
Search for alert content based on the search criteria.
Note
EnOS Edge does not support OU verification for this API.
Request Format¶
POST https://{apigw-address}/event-service/v2.1/alert-contents?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 |
---|---|---|---|
modelId | Optional | String | The model ID. How to get modelID>> |
alertTypeId | Optional | String | The alert type ID. |
subAlertTypeId | Optional | String | The alert sub-type ID. |
expression | Optional | String | The query expression, which supports sql-like query. The supported logical operators are “and” and “or”, and query fields are as per the below.
|
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 updateTime . The maximum records per page is 1000 but for optimal performance, it is recommended to have not more than 50 records per page. Alternatively, you can use the following field sorting criterion: contentId , modelId , alertTypeId , subAlertTypeId . For more details, see Pagination Request Struct. |
Response Parameters¶
Name | Data Type | Description |
---|---|---|
data | Array of AlertContent Structs | A list of the alert content. For details of an alertContent struct, see AlertContent Struct. |
AlertContent Struct ¶
Name | Data Type | Description |
---|---|---|
contentId | String | The alert content ID. |
contentDesc | StringI18n | The alert content description. |
modelId | String | The model ID. |
orgId | String | The organization ID which the asset belongs to. |
alertType | AlertType Struct | The details of the alert type. For more information, see AlertType Struct>> |
subAlertType | AlertType Struct | The details of the alert sub-type. For more information, see AlertType Struct>> |
tags | Map | User-defined tags. (The Key and Value are of String type.) |
updatePerson | String | The name of the person who last updated the alert severity. |
updateTime | Long | The time when the alert was last updated in UTC format. |
Samples¶
Request Sample¶
url: https://{apigw-address}/event-service/v2.1/alert-contents?action=search&orgId=yourOrgId
method: POST
requestBody:
{
"pagination": {
"pageNo": 1,
"pageSize": 1,
"sorters": [{
"field": "contentId",
"order": "DESC"
}]
},
"action": "search"
}
Return Sample¶
{
"pagination": {
"pageNo": 1,
"pageSize": 1,
"totalSize": 9,
"sortedBy": [{
"field": "contentId",
"order": "DESC"
}]
},
"code": 0,
"msg": "OK",
"requestId": "c4e28bda-8d76-4145-bc42-11bfc2c09c0d",
"data": [{
"contentId": "dateContentid",
"contentDesc": {
"defaultValue": null,
"i18nValue": {
"en_US": "dateContentid desc",
"zh_CN": ""
}
},
"modelId": "ssss",
"orgId": "yourOrgId",
"updatePerson": "test_user",
"updateTime": 1546612131000,
"alertType": {
"typeId": "dateType",
"orgId": "o15724268424841",
"parentTypeId": null,
"updatePerson": null,
"source":null,
"typeDesc": {
"i18nValue": {
"defaultValue": null,
"en_US": "dateType desc",
"zh_CN": ""
}
},
"tags": {
},
"updateTime": 0
},
"subAlertType": {
"typeDesc": {
"i18nValue": {
"defaultValue": null,
"en_US": "dateType desc",
"zh_CN": ""
}
},
"orgId": "o15724268424841",
"parentTypeId": null,
"updatePerson": null,
"source":null,
"tags": {
},
"updateTime": 0
},
"tags": {
}
}]
}
Java SDK Sample¶
public void testSearchAlertContent() {
private static String accessKey = "yourAppAccessKey";
private static String secretKey = "yourAppSecretKey";
private static String orgId = "yourOrgId";
private static String url = "https://{apigw-address}";
SearchAlertContentRequest request = new SearchAlertContentRequest();
request.setOrgId(orgId);
request.setModelId("ssss");
Pagination pagination = new Pagination();
pagination.setPageNo(1);
pagination.setPageSize(1);
List < Sorter > sorterList = new ArrayList < > ();
sorterList.add(new Sorter("contentId", Sorter.Order.DESC));
pagination.setSorters(sorterList);
request.setPagination(pagination);
try {
SearchAlertContentResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
.url(url)
.getResponse(request, SearchAlertContentResponse.class);
Gson gson = new Gson();
System.out.println(gson.toJson(response));
} catch (Exception e) {
e.printStackTrace();
}
}