debian-mirror-gitlab/doc/api/project_statistics.md

57 lines
1.3 KiB
Markdown
Raw Normal View History

2020-10-24 23:57:45 +05:30
---
stage: Create
group: Source Code
2022-11-25 23:54:43 +05:30
info: "To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments"
2020-10-24 23:57:45 +05:30
type: reference, api
---
2021-03-11 19:13:27 +05:30
# Project statistics API **(FREE)**
2019-07-07 11:18:12 +05:30
Every API call to [project](../user/project/index.md) statistics must be authenticated.
2021-11-18 22:05:49 +05:30
Retrieving these statistics requires write access to the repository.
2019-07-07 11:18:12 +05:30
2021-11-18 22:05:49 +05:30
This API retrieves the number of times the project is either cloned or pulled
with the HTTP method. SSH fetches are not included.
2019-07-07 11:18:12 +05:30
2021-11-18 22:05:49 +05:30
## Get the statistics of the last 30 days
2019-07-07 11:18:12 +05:30
2020-04-08 14:13:33 +05:30
```plaintext
2019-07-07 11:18:12 +05:30
GET /projects/:id/statistics
```
| Attribute | Type | Required | Description |
| ---------- | ------ | -------- | ----------- |
2022-01-26 12:08:38 +05:30
| `id` | integer or string | yes | The ID or [URL-encoded path of the project](index.md#namespaced-path-encoding) |
2019-07-07 11:18:12 +05:30
Example response:
```json
{
"fetches": {
"total": 50,
"days": [
{
"count": 10,
"date": "2018-01-10"
},
{
"count": 10,
"date": "2018-01-09"
},
{
"count": 10,
"date": "2018-01-08"
},
{
"count": 10,
"date": "2018-01-07"
},
{
"count": 10,
"date": "2018-01-06"
}
]
}
}
```