Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-04-12 14:19:45 +0300
committerRémy Coutable <remy@rymai.me>2017-04-14 16:20:55 +0300
commit91ac0e038ab51dd2f30f2bb7c91837fa588ca250 (patch)
tree54b5ea7cb6115a09bbcead558252563664b4898c /doc/api/users.md
parent3cb84e06b7a118fb46b4e1e0d4885026c9d4a4d1 (diff)
Port 'Add user activities API' to CE
CE port of https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/962
Diffstat (limited to 'doc/api/users.md')
-rw-r--r--doc/api/users.md53
1 files changed, 53 insertions, 0 deletions
diff --git a/doc/api/users.md b/doc/api/users.md
index 2ada4d09c84..84dbc350e6b 100644
--- a/doc/api/users.md
+++ b/doc/api/users.md
@@ -986,3 +986,56 @@ Parameters:
| --------- | ---- | -------- | ----------- |
| `user_id` | integer | yes | The ID of the user |
| `impersonation_token_id` | integer | yes | The ID of the impersonation token |
+
+### Get user activities (admin only)
+
+>**Note:** This API endpoint is only available on 8.15 (EE) and 9.1 (CE) and above.
+
+Get the last activity date for all users, sorted from oldest to newest.
+
+The activities that update the timestamp are:
+
+ - Git HTTP/SSH activities (such as clone, push)
+ - User logging in into GitLab
+
+The data is stored in Redis and it depends on it for being recorded and displayed
+over time. This means that we will lose the data if Redis gets flushed, or a custom
+TTL is reached.
+
+By default, it shows the activity for all users in the last 6 months, but this can be
+amended by using the `from` parameter.
+
+This function takes pagination parameters `page` and `per_page` to restrict the list of users.
+
+
+```
+GET /user/activities
+```
+
+Parameters:
+
+| Attribute | Type | Required | Description |
+| --------- | ---- | -------- | ----------- |
+| `from` | string | no | Date string in the format YEAR-MONTH-DAY, e.g. `2016-03-11`. Defaults to 6 months ago. |
+
+```bash
+curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/user/activities
+```
+
+Example response:
+
+```json
+[
+ {
+ "username": "user1",
+ "last_activity_at": "2015-12-14 01:00:00"
+ },
+ {
+ "username": "user2",
+ "last_activity_at": "2015-12-15 01:00:00"
+ },
+ {
+ "username": "user3",
+ "last_activity_at": "2015-12-16 01:00:00"
+ }
+]