diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-15 06:06:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-15 06:06:34 +0300 |
commit | 41d446ba3f0518097eb350b142ecfbeeb6be83e6 (patch) | |
tree | 465127e4d63fe9d0c61ab7f281737e588a04a4ae /doc/api/audit_events.md | |
parent | 386e5740f68fc7f49bc7692a28e927d6ea5ab056 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/api/audit_events.md')
-rw-r--r-- | doc/api/audit_events.md | 114 |
1 files changed, 111 insertions, 3 deletions
diff --git a/doc/api/audit_events.md b/doc/api/audit_events.md index 0b8351062e5..e451b975d42 100644 --- a/doc/api/audit_events.md +++ b/doc/api/audit_events.md @@ -1,10 +1,12 @@ -# Audit Events API **(PREMIUM ONLY)** +# Audit Events API + +## Instance Audit Events **(PREMIUM ONLY)** The Audit Events API allows you to retrieve [instance audit events](../administration/audit_events.md#instance-events-premium-only). To retrieve audit events using the API, you must [authenticate yourself](README.html#authentication) as an Administrator. -## Retrieve all instance audit events +### Retrieve all instance audit events ``` GET /audit_events @@ -83,7 +85,7 @@ Example response: ] ``` -## Retrieve single instance audit event +### Retrieve single instance audit event ``` GET /audit_events/:id @@ -113,3 +115,109 @@ Example response: "created_at": "2019-08-30T07:00:41.885Z" } ``` + +## Group Audit Events **(STARTER)** + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/34078) in GitLab 12.5. + +The Group Audit Events API allows you to retrieve [group audit events](../administration/audit_events.html#group-events-starter). + +To retrieve group audit events using the API, you must [authenticate yourself](README.html#authentication) as an Administrator or an owner of the group. + +### Retrieve all group audit events + +``` +GET /groups/:id/audit_events +``` + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) | +| `created_after` | string | no | Return group audit events created on or after the given time. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ | +| `created_before` | string | no | Return group audit events created on or before the given time. Format: ISO 8601 YYYY-MM-DDTHH:MM:SSZ | + +By default, `GET` requests return 20 results at a time because the API results +are paginated. + +Read more on [pagination](README.md#pagination). + +```bash +curl --header "PRIVATE-TOKEN: <your_access_token>" https://primary.example.com/api/v4/groups/60/audit_events +``` + +Example response: + +```json +[ + { + "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 + +Only available to group owners and administrators. + +``` +GET /groups/:id/audit_events/:audit_event_id +``` + +| Attribute | Type | Required | Description | +| --------- | ---- | -------- | ----------- | +| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) | +| `audit_event_id` | integer | yes | ID of the audit event | + +```bash +curl --header "PRIVATE-TOKEN: <your_access_token>" https://primary.example.com/api/v4/groups/60/audit_events/2 +``` + +Example response: + +```json +{ + "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" +} +``` |