Reporting an Event
Function
This API is used to report custom events. Events with the same time, project_id, event_source, event_name, event_type, sub_event_type, event_state, event_level, event_user, resource_id, and resource_name fields are considered as the same event.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
ces:events:post
Write
-
-
-
-
URI
POST /V1.0/{project_id}/events
| 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
| 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 Default value application/json; charset=UTF-8 is recommended. 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 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| [items] | Yes | Array of CreateEventsRequestBody objects | This API is used to report custom events. Request parameter. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| event_name | Yes | String | Definition: Event name. Constraints: N/A Range: The value must start with a letter and can include 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. You can set this parameter based on your service needs. It can include 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 |
| 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: ID of the resource group that the event belongs to. This ID must be valid. To query the group ID, you can: 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: 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, at signs (@), underscores (_), hyphens (-), and periods (.). Default Value N/A |
| event_state | No | String | Definition: Event status. Constraints: N/A Range: The value can be: Default Value: N/A |
| event_level | No | String | Definition: Event severity. Constraints: N/A Range: The value can be: 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: Default Value: N/A |
| sub_event_type | No | String | Definition: Event subcategory. Constraints: N/A Range: The value can be: 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. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Definition Dimension of a resource. For example, the dimension of an ECS is instance_id . A maximum of four dimensions are supported. For details about the dimension names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye. Constraints N/A Range The value starts with a letter and allows 1 to 32 characters. It can contain only letters, digits, underscores (_), and hyphens (-). 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
| Parameter | Type | Description |
|---|---|---|
| [items] | Array of Event objects | Event response body. |
| Parameter | Type | Description |
|---|---|---|
| event_id | String | Definition Event ID. Range N/A |
| event_name | String | Definition Event name. Range N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| - | String | Request error. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| - | String | The authentication information is not provided or is incorrect. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| - | String | Access to the requested page is forbidden. |
Status code: 408
| Parameter | Type | Description |
|---|---|---|
| - | String | The request timed out. |
Status code: 429
| Parameter | Type | Description |
|---|---|---|
| - | String | Too many requests. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| - | String | Failed to complete the request because of an internal service error. |
Status code: 503
| Parameter | Type | Description |
|---|---|---|
| - | String | The system is currently unavailable. |
Example Requests
[ {
"event_name" : "systemInvaded",
"event_source" : "financial.System",
"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.System",
"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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot