Event Query Interface
Query
API description
Use this feature to query user audit events.
Permission description
The Access Key and request signature mechanism are uniformly adopted for all API security authentication. Access Key consists of an Access Key ID and a Secret Access Key, both of which are strings. For each HTTP request, use the algorithm described below to generate a authentication string. Submit the certification string in the Authorization header. The server verifies the correctness of the authentication string based on the generation algorithm. The certification string format is bce-auth-v{version}/{accessKeyId}/{timestamp}/{expirationPeriodInSeconds}/{signedHeaders}/{signature}.
- The version is a positive integer.
- The timestamp refers to the UTC time when the signature is created.
- The expirationPeriodInSeconds specifies the duration during which the signature remains valid.
- SignedHeaders includes the list of headers involved in the signature algorithm. The headers are separated by semicolons (e.g., host;x-bce-date) and arranged in lexicographical order. (This API signature involves only the host and x-bce-date headers.)
- The signature is a 256-bit signature represented as a 64-character lowercase hexadecimal digest.
When Baidu AI Cloud receives a user's request, the system uses the same SK and certification mechanism to generate a certification string. This string is then compared with the one included in the user's request. If the two match, the system confirms the user has the required permissions and proceeds with the operation. If they differ, the system cancels the operation and returns an error code.
For detailed information on the authentication mechanism, please refer to [Authentication](Reference/Authentication mechanism/Introduction.md).
Notes
Root accounts, administrator IAM users, and IAM users authorized with BCTReadPolicy or BCTFullControlPolicy can access to the interface via AK/SK
Request structure
1POST /v1/events/query HTTP/1.1
2Host: iam.bj.baidubce.com
3Authorization: authorization string
4{
5 "filters": [
6 {
7 "field": "field1",
8 "value": "value1"
9 },
10 {
11 "field": "field2",
12 "value": "value2"
13 }
14 ],
15 "startTime": "startTime",
16 "endTime": "endTime",
17 "pageNo": startNo,
18 "pageSize": size
19}
Request headers
There are no special headers required beyond the common headers.
Request parameters
| Parameter name | Types | Whether required | Parameter location | Description |
|---|---|---|---|---|
| pageNo | int | Yes | RequestBody | Page number, with a minimum of 1 |
| pageSize | int | Yes | RequestBody | Number of items per page, with a minimum of 1 and maximum of 100 |
| startTime | string | Yes | RequestBody | Query start time, in UTC |
| endTime | string | Yes | RequestBody | Query end time, in UTC |
| domainId | string | Yes | RequestBody | Account ID, corresponding to the signature information in the request header |
| filters | List<[Filter](BCT/API Reference/Data type.md#Filter)> | Yes | RequestBody | Query filter conditions, in array format |
Response headers
There are no special headers required beyond the common headers.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| page | int | Pagination count |
| pageSize | int | Number of items per page, with a minimum of 1 |
| total | int | Total queries |
| data | List<[Event](BCT/API Reference/Data type.md#Event)> | Event details array |
Request example
1POST http://iam.bj.baidubce.com/v1/events/query
2Host: iam.bj.baidubce.com
3Authorization: bce-auth-v1/e5760f03b10841cbbb73888755367f4e/2020-08-13T07:14:30Z/1800/host/4926f1123e6ea395e6e98ff0c5f2e21b37b8f76531a7e18da7dbdeec9ac0bce8
4
5{
6 "domainId": "d22e12e9d0af4b53b700787b338b8",
7 "startTime": "2023-05-09T16:00:00Z",
8 "endTime": "2023-12-26T15:59:59Z",
9 "filters": [
10 {
11 "field": "eventName",
12 "value": "ConsoleLogin"
13 },
14 {
15 "field": "currentUser",
16 "value": "d22e12e9d0af4b53b700787b338b8"
17 }
18 ],
19 "pageNo": 1,
20 "pageSize": 30
21}
Response example
1HTTP/1.1 200 OK
2X-Bce-Request-Id: ef4d2887-0e3c-4dce-ad67-06e4afa7f342
3Date: Thu, 13 Aug 2020 07:15:25 GMT
4Content-Type: application/json; charset=utf-8
5
6{
7 "total":1,
8 "page":1,
9 "pageSize":30,
10 "data":[
11 {
12 "eventType": "Ordinary Event",
13 "eventSource":"login",
14 "eventName":"ConsoleLogin",
15 "eventTimeInMilliseconds":1597040510728,
16 "eventTime":"2020-08-10T06:21:50Z",
17 "userIpAddress":"211.95.58.7",
18 "userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.",
19 "regionId":"",
20 "requestId":"e63acc154ad84b3db140f58f07ae78ce",
21 "orderId":"",
22 "apiVersion":"1.0.0",
23 "description":"",
24 "errorCode":"302",
25 "errorMessage":"",
26 "success":true,
27 "userIdentity":{
28 "iamDomainId":"d22e12e9d0af4b53b700787b338b8",
29 "iamUserId":"d22e12e9d0af4b53b700787b338",
30 "loginUserId":"",
31 "userDisplayName":"test_user"
32 }
33 ]
34 }
