Search Alert Severity


Search for alert severity based on the search criteria.

Request Format

POST https://{apigw-address}/event-service/v2.1/alert-severities?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 supported logical operators are “and” and “or”, and query fields are as per the below.

  • severityId: supports operators “=” and “in”.

  • tags.*: supports operator “=”. Note: EnOS Edge does not support tag queries.

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 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 specify severityId as the sorting criterion. For more details, see Pagination Request Struct.

Response Parameters

Name

Data Type

Description

data

Array of AlertSeverity Structs

A list of the alert severities. For details of an alertSeverity struct, see AlertSeverity Struct.

AlertSeverity Struct

Name

Data Type

Description

severityId

String

The alert severity ID.

orgId

String

The organization ID which the asset belongs to.

severityDesc

StringI18n

The alert severity description.

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-severities?action=search&orgId=yourOrgId
method: POST
requestBody:
{
    "pagination": {
        "pageNo": 1,
        "pageSize": 1,
        "sorters": [{
            "field": "severityID",
            "order": "ASC"
        }]
    }
}

Return Sample

{
    "pagination": {
        "pageNo": 1,
        "pageSize": 1,
        "totalSize": 19,
        "sortedBy": [{
            "field": "severityID",
            "order": "ASC"
        }]
    },
    "code": 0,
    "msg": "OK",
    "requestId": "bd591868-0eb1-46dc-a989-c1de33cc671e",
    "data": [{
        "severityId": "001",
        "orgId": "yourOrgId",
        "severityDesc": {
      "defaultValue": null,
            "i18nValue": {
                "en_US": "Serious!!!",
                "zh_CN": "严重!!!"
            }
        },
        "tags": {
            "111": "2222"
        },
        "updatePerson": "yj_test_customer",
        "updateTime": 1559204166000,
    "source": null,
    }]
}

Java SDK Sample

public void testSearchAlertSeverity() {
    SearchAlertSeverityRequest request = new SearchAlertSeverityRequest();
    request.setOrgId("yourOrgId");
    Pagination pagination = new Pagination();
    pagination.setPageSize(1);
    pagination.setPageNo(1);
    Sorter sorter = new Sorter(field: "severityId", Sorter.Order.ASC);
    List < Sorter > sorterList = new ArrayList < > ();
    sorterList.add(sorter);
    pagination.setSorters(sorterList);
    request.setPagination(pagination);
    try {
        SearchAlertSeverityResponse response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
            .url("https://{apigw-address}")
            .getResponse(request, SearchAlertSeverityResponse.class);
        Gson gson = new Gson();
        System.out.println(gson.toJson(response));
    } catch (Exception e) {
        System.out.print(e);
    }
}