Updated on 2025-09-09 GMT+08:00

Querying Events

Function

This API is used to query events, including system events and custom events.

Event subcategory parameters are only available in regions CN East-Shanghai1, CN East-Shanghai2, CN North-Beijing4, and CN South-Guangzhou.

Debugging

You can debug the API in API Explorer which supports automatic authentication. API Explorer can automatically generate and debug example SDK code.

URI

GET /V1.0/{project_id}/events

  • Parameter description
    Table 1 Parameter description

    Parameter

    Type

    Mandatory

    Description

    project_id

    String

    Yes

    Definition

    Project ID, which is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details about how to obtain the project ID, see Obtaining a Project ID.

    Constraints

    N/A

    Range

    1 to 64 characters

    Default Value

    N/A

    event_type

    String

    No

    Definition

    Event type.

    Constraints

    N/A

    Range

    The value can be:

    • EVENT.SYS: system event
    • EVENT.CUSTOM: custom event

    Default Value

    N/A

    sub_event_type

    String

    No

    Definition

    Event subcategory.

    Constraints

    N/A

    Range

    The options are as follows: If the event type is system event, the value can be SUB_EVENT.OPS (O&M event) or SUB_EVENT.PLAN (planned event).

    If the event type is custom event, the value is SUB_EVENT.CUSTOM (custom event).

    Default Value

    SUB_EVENT.OPS

    event_name

    String

    No

    Definition

    Event name. The name can be a system event name or a custom event name.

    Constraints

    N/A

    Range

    1 to 64 characters

    Default Value

    N/A

    from

    Integer

    No

    Definition

    Start time of the query. The value is a UNIX timestamp, in milliseconds. Example: 1605952700911

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    to

    Integer

    No

    Definition

    End time of the query. The value is a UNIX timestamp, in milliseconds. Example: 1606557500911

    Constraints

    from must be earlier than to.

    Range

    N/A

    Default Value

    N/A

    start

    Integer

    No

    Definition

    Pagination start value. The value is an integer.

    Constraints

    N/A

    Range

    ≥ 0

    Default Value

    0

    limit

    Integer

    No

    Definition

    Maximum number of records that can be queried at a time.

    Constraints

    N/A

    Range

    (0,100]

    Default Value

    100

  • Example
    GET https://{Cloud Eye endpoint}/V1.0/{project_id}/events

Request

None

Response

  • Response parameters
Table 2 Parameter description

Parameter

Type

Mandatory

Description

events

Array of Events objects

No

Definition

One or more pieces of event data.

For details, see Table 3.

meta_data

MetaData object

No

Definition

Number of metadata records in the query results.

For details, see Table 4.

Table 3 events field description

Parameter

Type

Mandatory

Description

event_name

String

No

Definition

Event name.

Range

N/A

event_type

String

No

Definition

Event type.

Range

N/A

sub_event_type

String

No

Definition

Event subcategory.

Range

The value can be:

  • SUB_EVENT.OPS: O&M event
  • SUB_EVENT.PLAN: planned event
  • SUB_EVENT.CUSTOM: custom event

event_count

Integer

No

Definition

Number of times that the event occurs within the specified time range.

Range

N/A

latest_occur_time

Long

No

Definition

Time when the event last occurred.

Range

N/A

latest_event_source

String

No

Definition

Event source. If the event is a system event, the source is the namespace of each service. To view the namespace of each service, see Services Interconnected with Cloud Eye.

If the event is a custom event, the event source is defined by the user.

Range

N/A

Table 4 meta_data data structure description

Parameter

Type

Mandatory

Description

total

Integer

No

Definition

Total number of events.

Range

N/A

  • Example response
    {
     "events": [
       {
         "event_name": "rebootServer",
         "event_type": "EVENT.SYS",
         "sub_event_type": "SUB_EVENT.OPS",
         "event_count": 5,
         "latest_occur_time": 1606302400000,
         "latest_event_source": "SYS.ECS"
       },
       {
         "event_name": "deleteVolume",
         "event_type": "EVENT.SYS",
         "sub_event_type": "SUB_EVENT.OPS",
         "event_count": 6,
         "latest_occur_time": 1606300359126,
         "latest_event_source": "SYS.EVS"
       },
       {
         "event_name": "event_001",
         "event_type": "EVENT.CUSTOM",
         "sub_event_type": "SUB_EVENT.CUSTOM",
         "event_count": 4,
         "latest_occur_time": 1606499035522,
         "latest_event_source": "TEST.System"
       }
     ],
     "meta_data": {
       "total": 10
     }
    }

Returned Values

  • Normal

    200

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    Request error.

    401 Unauthorized

    The authentication information is not provided or is incorrect.

    403 Forbidden

    Access to the requested page is forbidden.

    408 Request Timeout

    The request timed out.

    429 Too Many Requests

    Concurrent requests are excessive.

    500 Internal Server Error

    Failed to complete the request because of an internal service error.

    503 Service Unavailable

    The service is currently unavailable.

Error Codes

See Error Codes.