Updated on 2025-11-20 GMT+08:00

Reporting an Event

Function

This API is used to report custom events.

URI

POST /V1.0/{project_id}/events

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID. It 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, see Obtaining a Project ID.

Constraints

N/A

Range

1 to 64 characters

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

String

Definition

MIME type of the request body.

Constraints

N/A

Range

1 to 64 characters

Default Value

The default value is application/json; charset=UTF-8. For APIs used to upload objects or images, the MIME type varies with the flow type.

X-Auth-Token

No

String

Definition

User token.

Constraints

N/A

Range

1 to 16,384 characters

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

[items]

Yes

Array of CreateEventsRequestBody objects

This API is used to report custom events. Request parameter.

Table 4 CreateEventsRequestBody

Parameter

Mandatory

Type

Description

event_name

Yes

String

Definition:

Event name.

Constraints:

N/A

Range:

The value must start with a letter and can contain 1 to 64 characters. It can only contain letters, digits, and underscores (_).

Default Value:

N/A

event_source

Yes

String

Definition:

Event source.

Constraints:

N/A

Range:

The value is in the service.item format. Set this parameter based on the service needs.

It can contain 3 to 32 characters. service and item each must start with a letter and contain only letters, digits, and underscores (_).

Default Value:

N/A

time

Yes

Long

Definition:

Time when an event occurred. The value is a UNIX timestamp in milliseconds.

Constraints:

Since there is a latency between the client and the server, the timestamp when data was inserted must be within the time range [Current time – 1h + 10s, Current time + 10 mins – 10s]. In this way, the data will be inserted to the database without being affected by the latency.

Range:

The timestamp when data was inserted must be within the time range [Current time – 1h + 10s, Current time + 10 mins – 10s].

Default Value:

N/A

detail

Yes

EventItemDetail object

Definition:

Event details.

Constraints:

N/A

Table 5 EventItemDetail

Parameter

Mandatory

Type

Description

content

No

String

Definition:

Event content.

Constraints:

N/A

Range:

[0,4096]

Default Value:

N/A

group_id

No

String

Definition:

Resource group that the event belongs to.

This ID must be the that of an existing resource group.

To query the group ID, you can:

  1. Log in to the management console.

  2. Choose Cloud Eye.

  3. Choose Resource Groups in the navigation pane.

Obtain the group ID in the Name/ID column.

Constraints:

N/A

Range:

24 characters

Default Value:

N/A

resource_id

No

String

Definition:

Resource ID.

To query the resource ID, you can:

  1. Log in to the management console.

  2. Choose Compute > Elastic Cloud Server.

On the Resource Overview page, obtain the resource ID.

Constraints:

N/A

Range:

The value allows a maximum of 128 characters and can only contain letters, digits, underscores (_), hyphens (-), and colons (:). Example: 6a69bf28-ee62-49f3-9785-845dacd799ec

Default Value:

N/A

resource_name

No

String

Definition:

Resource name.

Constraints:

N/A

Range:

The value allows a maximum of 128 characters and can contain letters, digits, underscores (_), hyphens (-), and periods (.).

Default Value:

N/A

event_state

No

String

Definition:

Event status.

Constraints:

N/A

Range:

The value can be:

  • normal: normal

  • warning: abnormal

  • incident: critical

Default Value:

N/A

event_level

No

String

Definition:

Event severity.

Constraints:

N/A

Range:

The value can be:

  • Critical

  • Major

  • Minor

  • Info

Default Value:

N/A

event_user

No

String

Definition:

Event user.

Constraints:

N/A

Range:

The value allows 0 to 64 characters and can contain letters, digits, underscores (_), hyphens (-), and spaces.

Default Value:

N/A

event_type

No

String

Definition:

Event type.

Constraints:

EVENT.SYS indicates a system event, which cannot be reported by users. Only EVENT.CUSTOM can be transferred.

Range:

The value can be:

  • EVENT.SYS: system events

  • EVENT.CUSTOM: custom events

Default Value:

N/A

sub_event_type

No

String

Definition:

Event subcategory.

Constraints:

N/A

Range:

The value can be:

  • SUB_EVENT.OPS: O&M event

  • SUB_EVENT.PLAN: planned event

  • SUB_EVENT.CUSTOM: custom event

Default Value:

N/A

dimensions

No

Array of MetricsDimension objects

Definition:

Event dimension. Resource information is described by dimension.

Event alarm rules can be configured by dimension to monitor specified resources and resource groups.

Constraints:

A maximum of four dimensions are supported.

Table 6 MetricsDimension

Parameter

Mandatory

Type

Description

name

Yes

String

Definition:

Dimension of a resource. For example, the dimension of an ECS can be instance_id. A maximum of four dimensions are supported. For the metric dimension of each resource, see Service metric dimension.

Constraints

N/A

Range:

The value starts with a letter and can contain letters, digits, underscores (_), or hyphens (-). The length is [1,32] characters.

Default Value:

N/A

value

Yes

String

Definition

Resource dimension value, which is an instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755.

Constraints

N/A

Range

1 to 256 characters

Default Value

N/A

Response Parameters

Status code: 201

Table 7 Response body parameters

Parameter

Type

Description

event_id

String

Definition:

Event ID.

Range:

N/A

event_name

String

Definition:

Event name.

Range:

N/A

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

-

String

Request error.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

-

String

The authentication information is not provided or is incorrect.

Status code: 403

Table 10 Response body parameters

Parameter

Type

Description

-

String

Access to the requested page is forbidden.

Status code: 408

Table 11 Response body parameters

Parameter

Type

Description

-

String

The request timed out.

Status code: 429

Table 12 Response body parameters

Parameter

Type

Description

-

String

Too many requests.

Status code: 500

Table 13 Response body parameters

Parameter

Type

Description

-

String

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

Status code: 503

Table 14 Response body parameters

Parameter

Type

Description

-

String

The system is currently unavailable.

Example Requests

[ {
  "event_name" : "systemInvaded",
  "event_source" : "financial.Sytem",
  "time" : 1522121194000,
  "detail" : {
    "content" : "The financial system was invaded",
    "group_id" : "rg15221211517051YWWkEnVd",
    "resource_id" : "1234567890sjgggad",
    "resource_name" : "ecs001",
    "event_state" : "normal",
    "event_level" : "Major",
    "event_user" : "xiaokong"
  }
}, {
  "event_name" : "systemInvaded",
  "event_source" : "financial.Sytem",
  "time" : 1522121194020,
  "detail" : {
    "content" : "The financial system was invaded",
    "group_id" : "rg15221211517051YWWkEnVd",
    "resource_id" : "1234567890sjgggad",
    "resource_name" : "ecs001",
    "event_state" : "normal",
    "event_level" : "Major",
    "event_user" : "xihong"
  }
} ]

Example Responses

Status code: 201

Created

[ {
  "event_id" : "evdgiqwgedkkcvhdjcdu346",
  "event_name" : "systemInvaded"
}, {
  "event_id" : "evdgiqwgedkkcvhdjcdu347",
  "event_name" : "systemParalysis"
} ]

Status Codes

Status Code

Description

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

408

Request Timeout

429

Too Many Requests

500

Internal Server Error

503

Service Unavailable

Error Codes

See Error Codes.