Audit Events API
Audit Events API
Audit Events API 使您可以检索实例审核事件 .
要使用 API检索审核事件,您必须以管理员 .
默认情况下,因为 API 结果是分页的,所以GET
请求一次返回 20 个结果.
阅读有关分页的更多信息.
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/audit_events"
响应示例:
[ { "id": 1, "author_id": 1, "entity_id": 6, "entity_type": "Project", "details": { "custom_message": "Project archived", "author_name": "Administrator", "target_id": "flightjs/flight", "target_type": "Project", "target_details": "flightjs/flight", "ip_address": "127.0.0.1", "entity_path": "flightjs/flight" }, "created_at": "2019-08-30T07:00:41.885Z" }, { "id": 2, "author_id": 1, "entity_id": 60, "entity_type": "Group", "details": { "add": "group", "author_name": "Administrator", "target_id": "flightjs", "target_type": "Group", "target_details": "flightjs", "ip_address": "127.0.0.1", "entity_path": "flightjs" }, "created_at": "2019-08-27T18:36:44.162Z" }, { "id": 3, "author_id": 51, "entity_id": 51, "entity_type": "User", "details": { "change": "email address", "from": "hello@flightjs.com", "to": "maintainer@flightjs.com", "author_name": "Andreas", "target_id": 51, "target_type": "User", "target_details": "Andreas", "ip_address": null, "entity_path": "Andreas" }, "created_at": "2019-08-22T16:34:25.639Z" } ]
Retrieve single instance audit event
Attribute | Type | Required | Description |
---|---|---|---|
integer | yes | 审核事件的 ID |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/audit_events/1"
响应示例:
{ "id": 1, "author_id": 1, "entity_id": 6, "entity_type": "Project", "details": { "custom_message": "Project archived", "author_name": "Administrator", "target_id": "flightjs/flight", "target_type": "Project", "target_details": "flightjs/flight", "ip_address": "127.0.0.1", "entity_path": "flightjs/flight" }, "created_at": "2019-08-30T07:00:41.885Z" }
组审核事件 API 使您可以检索组审核事件 .
要使用 API检索组审核事件,您必须通过管理员或组所有者身份进行身份验证 .
默认情况下,因为 API 结果是分页的,所以GET
请求一次返回 20 个结果.
阅读有关更多信息.
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/groups/60/audit_events"
响应示例:
[ { "id": 2, "author_id": 1, "entity_id": 60, "entity_type": "Group", "details": { "custom_message": "Group marked for deletion", "author_name": "Administrator", "target_id": "flightjs", "target_type": "Group", "target_details": "flightjs", "ip_address": "127.0.0.1", "entity_path": "flightjs" }, "created_at": "2019-08-28T19:36:44.162Z" }, { "id": 1, "author_id": 1, "entity_id": 60, "entity_type": "Group", "details": { "add": "group", "author_name": "Administrator", "target_id": "flightjs", "target_type": "Group", "target_details": "flightjs", "ip_address": "127.0.0.1", "entity_path": "flightjs" }, "created_at": "2019-08-27T18:36:44.162Z" } ]
Retrieve a specific group audit event
仅对组所有者和管理员可用.
GET /groups/:id/audit_events/:audit_event_id
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 组的 ID 或 |
audit_event_id |
integer | yes | 审核事件的 ID |
{ "id": 2, "author_id": 1, "entity_id": 60, "entity_type": "Group", "details": { "custom_message": "Group marked for deletion", "author_name": "Administrator", "target_id": "flightjs", "target_type": "Group", "target_details": "flightjs", "ip_address": "127.0.0.1", "entity_path": "flightjs" }, "created_at": "2019-08-28T19:36:44.162Z" }
在 GitLab 13.1 中引入 .
通过 Project Audit Events API,您可以检索 .
To retrieve project audit events using the API, you must authenticate yourself as a Maintainer or an Owner of the project.
默认情况下,因为 API 结果是分页的,所以GET
请求一次返回 20 个结果.
阅读有关更多信息.
curl --header "PRIVATE-TOKEN: <your_access_token>" https://primary.example.com/api/v4/projects/7/audit_events
响应示例:
[ { "id": 5, "author_id": 1, "entity_id": 7, "entity_type": "Project", "details": { "change": "prevent merge request approval from reviewers", "from": "", "to": "true", "author_name": "Administrator", "target_id": 7, "target_type": "Project", "target_details": "twitter/typeahead-js", "ip_address": "127.0.0.1", "entity_path": "twitter/typeahead-js" }, "created_at": "2020-05-26T22:55:04.230Z" }, { "id": 4, "author_id": 1, "entity_id": 7, "entity_type": "Project", "details": { "change": "prevent merge request approval from authors", "from": "false", "to": "true", "author_name": "Administrator", "target_id": 7, "target_type": "Project", "target_details": "twitter/typeahead-js", "ip_address": "127.0.0.1", "entity_path": "twitter/typeahead-js" }, "created_at": "2020-05-26T22:55:04.218Z" } ]
Retrieve a specific project audit event
GET /projects/:id/audit_events/:audit_event_id
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 项目的 ID 或 |
audit_event_id |
integer | yes | 审核事件的 ID |
响应示例: