Help us learn about your current experience with the documentation. Take the survey.

项目统计 API

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

project 统计的每次 API 调用都必须进行身份验证。 获取这些统计信息需要读取仓库的权限。

使用 personal access token 时, 请使用具有 read_api 范围的令牌。对于 group access token, 可以使用 Reporter 角色和 read_api 范围。

此 API 获取项目通过 HTTP 方法被克隆或拉取的次数。 不包括 SSH 获取操作。

获取最近 30 天的统计数据

GET /projects/:id/statistics
属性 类型 必需 描述
id integer or string yes 项目的 ID 或 URL 编码路径

示例响应:

{
  "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"
      }
    ]
  }
}