Obtaining the Real-Time Service Event List
Function
This API applies to scenarios where real-time service events need to be monitored and managed. For example, users or O&M personnel need to periodically check service log events to detect and handle problems in a timely manner. By calling this API, you can obtain all event records of the current real-time service, including the event type, event information, time, and occurrence times. You must have the permission to query the service event list to successfully access this API. After the request is successful, the event list is returned. If the request fails, error information is returned. Common exceptions include permission verification errors, service status errors, and parameter verification errors.
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
modelarts:service:get
Read
service *
-
-
-
URI
GET /v2/{project_id}/services/{service_id}/events
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID and Name. Constraints N/A Range Project ID. Default Value N/A |
| service_id | Yes | String | Definition Service ID, which can be obtained from the response body during service creation or by obtaining services owned by the current user. The service_id field is the service ID. Constraints N/A Range Service ID. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| event_type | No | String | Definition Real-time service event type. Constraints N/A Range Default Value N/A |
| start_time | No | Long | Definition Event start time. Constraints N/A Range Millisecond-level timestamp, which is a 13-digit number. Default Value N/A |
| end_time | No | Long | Definition Event end time. Constraints N/A Range Millisecond-level timestamp, which is a 13-digit number. Default Value N/A |
| event_info_key | No | String | Definition Filter keyword of event information. Constraints The following characters are not supported: '";%_*!@#$&\ |
| limit | No | Integer | Definition Maximum number of records that can be returned. Constraints N/A Range [1,500] Default Value 10. |
| offset | No | Integer | Definition Offset of the pagination list query. Constraints The value must be an integral multiple of limit. Range N/A Default Value 0. |
| sort_key | No | String | Definition Sorting field. Separate multiple fields with commas (,). The value can be create_at or update_at. The default value is update_at. Constraints N/A Range Default Value update_at |
| sort_dir | No | String | Definition Sort order. Constraints N/A Range Default Value DESC |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. For details about how to obtain the token, see Obtaining a User Token Through Password Authentication. Constraints N/A Range N/A Default Value N/A |
| Content-Type | Yes | String | Definition Message body type or format. Constraints N/A Range Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| current | Integer | Definition Current page number. Range N/A |
| pages | Integer | Definition Total number of pages. Range N/A |
| size | Integer | Definition Number of records on each page. Range N/A |
| total | Integer | Definition The total number of records. Range N/A |
| data | Array of ServiceEventResponse objects | Definition Service event list. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Service event ID. Range N/A |
| service_id | String | Definition Service ID. Range N/A |
| service_version_id | String | Definition Service version ID. Range N/A |
| event_count | Integer | Definition Number of service event occurrences. Range N/A |
| event_type | String | Definition Service event type. The options are NORMAL, ABNORMAL, and WARNING. Range N/A |
| event_info | String | Definition Service event information. Range N/A |
| event_info_cn | String | Definition Service event information (Chinese). Range N/A |
| create_at | Long | Definition First occurrence time of a service event. Range N/A |
| update_at | Long | Definition Last occurrence time of a service event. Range N/A |
Example Requests
Obtain the real-time service event list.
GET https://{endpoint}/v2/{project_id}/services/{service_id}/events Example Responses
Status code: 200
The real-time service event list is obtained.
{
"current" : 0,
"data" : [ {
"create_at" : 1730446221357,
"event_count" : 1,
"event_info" : "Start to deploy service [xxx], version: 0.0.1, id: dcbadcba-dcba-dcba-dcba-dcbadcbadcba.",
"event_info_cn" : "Service *[xxx]** deployment started. Version: 0.0.1; ID: **dcbadcba-dcba-dcba-dcba-dcbadcbadcba**.",
"event_type" : "NORMAL",
"id" : "abcdabcd-abcd-abcd-abcd-abcdabcdabcd",
"service_id" : "dcbadcba-dcba-dcba-dcba-dcbadcbadcba",
"service_version_id" : "dcbadcba-dcba-dcba-dcba-dcbadcbadcba",
"update_at" : 1730446221357
}, {
"create_at" : 1730446254868,
"event_count" : 1,
"event_info" : "Service [xxx] create success.",
"event_info_cn" : "Service [xxx] deployed.",
"event_type" : "NORMAL",
"id" : "abcdabcd-abcd-abcd-abcd-abcdabcdabcd",
"service_id" : "dcbadcba-dcba-dcba-dcba-dcbadcbadcba",
"service_version_id" : "dcbadcba-dcba-dcba-dcba-dcbadcbadcba",
"update_at" : 1730446254868
} ],
"pages" : 1,
"size" : 10,
"total" : 2
} Status Codes
| Status Code | Description |
|---|---|
| 200 | The real-time service event list is obtained. |
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