ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
# Issues Statistics API > 原文:[https://docs.gitlab.com/ee/api/issues_statistics.html](https://docs.gitlab.com/ee/api/issues_statistics.html) * [Get issues statistics](#get-issues-statistics) * [Get group issues statistics](#get-group-issues-statistics) * [Get project issues statistics](#get-project-issues-statistics) # Issues Statistics API[](#issues-statistics-api "Permalink") 每个对 issue_statistics 的 API 调用都必须经过身份验证. 如果用户不是项目成员,并且该项目是私有项目,则对该项目的`GET`请求将导致`404`状态代码. ## Get issues statistics[](#get-issues-statistics "Permalink") 获取有关经过身份验证的用户有权访问的所有问题的问题计数统计信息. 默认情况下,它仅返回当前用户创建的问题. 要获取所有问题,请使用参数`scope=all` . ``` GET /issues_statistics GET /issues_statistics?labels=foo GET /issues_statistics?labels=foo,bar GET /issues_statistics?labels=foo,bar&state=opened GET /issues_statistics?milestone=1.0.0 GET /issues_statistics?milestone=1.0.0&state=opened GET /issues_statistics?iids[]=42&iids[]=43 GET /issues_statistics?author_id=5 GET /issues_statistics?assignee_id=5 GET /issues_statistics?my_reaction_emoji=star GET /issues_statistics?search=foo&in=title GET /issues_statistics?confidential=true ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `labels` | string | no | 标签名称的逗号分隔列表,必须具有要返回的所有标签的问题. `None`列出所有没有标签的问题. `Any`列出至少带有一个标签的所有问题. | | `milestone` | string | no | 里程碑标题. `None`列出没有里程碑的所有问题. `Any`列出具有指定里程碑的所有问题. | | `scope` | string | no | 回到问题在给定范围: `created_by_me` , `assigned_to_me`或`all` . 默认为`created_by_me` | | `author_id` | integer | no | 返回由给定用户`id`创建的问题. 与`author_username` . 与`scope=all`或`scope=assigned_to_me`结合使用. | | `author_username` | string | no | 返回由给定`username`创建的问题. 类似于`author_id`并且与`author_id` . | | `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. | | `assignee_username` | 字符串数组 | no | 返回分配给给定`username` . 类似于`assignee_id`并且与`assignee_id`互斥. 在 GitLab CE 中, `assignee_username`数组应仅包含单个值,否则将返回无效的参数错误. | | `my_reaction_emoji` | string | no | 返回的问题由已验证的用户通过给定的`emoji`响应. `None`返回没有响应的问题. 至少有一个反应, `Any`回报问题. | | `iids[]` | 整数数组 | no | 仅返回具有给定`iid`的问题 | | `search` | string | no | 根据`title`和`description`搜索问题 | | `in` | string | no | 修改`search`属性的范围. `title` , `description`或以逗号将它们连接在一起的字符串. 默认为`title,description` | | `created_after` | datetime | no | 返回在给定时间或之后创建的问题 | | `created_before` | datetime | no | 返回在给定时间或之前创建的问题 | | `updated_after` | datetime | no | 返回在给定时间或之后更新的问题 | | `updated_before` | datetime | no | 返回在给定时间或之前更新的问题 | | `confidential` | boolean | no | 过滤机密或公共问题. | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/issues_statistics" ``` 响应示例: ``` { "statistics": { "counts": { "all": 20, "closed": 5, "opened": 15 } } } ``` ## Get group issues statistics[](#get-group-issues-statistics "Permalink") 获取给定组的问题计数统计信息. ``` GET /groups/:id/issues_statistics GET /groups/:id/issues_statistics?labels=foo GET /groups/:id/issues_statistics?labels=foo,bar GET /groups/:id/issues_statistics?labels=foo,bar&state=opened GET /groups/:id/issues_statistics?milestone=1.0.0 GET /groups/:id/issues_statistics?milestone=1.0.0&state=opened GET /groups/:id/issues_statistics?iids[]=42&iids[]=43 GET /groups/:id/issues_statistics?search=issue+title+or+description GET /groups/:id/issues_statistics?author_id=5 GET /groups/:id/issues_statistics?assignee_id=5 GET /groups/:id/issues_statistics?my_reaction_emoji=star GET /groups/:id/issues_statistics?confidential=true ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 认证用户拥有[的组](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) | | `labels` | string | no | 标签名称的逗号分隔列表,必须具有要返回的所有标签的问题. `None`列出所有没有标签的问题. `Any`列出至少带有一个标签的所有问题. | | `iids[]` | 整数数组 | no | 仅返回具有给定`iid`的问题 | | `milestone` | string | no | 里程碑标题. `None`列出没有里程碑的所有问题. `Any`列出具有指定里程碑的所有问题. | | `scope` | string | no | 回到问题在给定范围: `created_by_me` , `assigned_to_me`或`all` . | | `author_id` | integer | no | 返回由给定用户`id`创建的问题. 与`author_username` . 与`scope=all`或`scope=assigned_to_me`结合使用. | | `author_username` | string | no | 返回由给定`username`创建的问题. 类似于`author_id`并且与`author_id` . | | `assignee_id` | integer | no | 返回分配给给定用户`id` . 互斥与`assignee_username` . `None`返回未分配的问题. 受让人有`Any`退货问题. | | `assignee_username` | 字符串数组 | no | 返回分配给给定`username` . 类似于`assignee_id`并且与`assignee_id`互斥. 在 GitLab CE 中, `assignee_username`数组应仅包含单个值,否则将返回无效的参数错误. | | `my_reaction_emoji` | string | no | 返回的问题由已验证的用户通过给定的`emoji`响应. `None`返回没有响应的问题. 至少有一个反应, `Any`回报问题. | | `search` | string | no | 搜索组问题的`title`和`description` | | `created_after` | datetime | no | 返回在给定时间或之后创建的问题 | | `created_before` | datetime | no | 返回在给定时间或之前创建的问题 | | `updated_after` | datetime | no | 返回在给定时间或之后更新的问题 | | `updated_before` | datetime | no | 返回在给定时间或之前更新的问题 | | `confidential` | boolean | no | 过滤机密或公共问题. | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/4/issues_statistics" ``` 响应示例: ``` { "statistics": { "counts": { "all": 20, "closed": 5, "opened": 15 } } } ``` ## Get project issues statistics[](#get-project-issues-statistics "Permalink") 获取给定项目的问题计数统计信息. ``` GET /projects/:id/issues_statistics GET /projects/:id/issues_statistics?labels=foo GET /projects/:id/issues_statistics?labels=foo,bar GET /projects/:id/issues_statistics?labels=foo,bar&state=opened GET /projects/:id/issues_statistics?milestone=1.0.0 GET /projects/:id/issues_statistics?milestone=1.0.0&state=opened GET /projects/:id/issues_statistics?iids[]=42&iids[]=43 GET /projects/:id/issues_statistics?search=issue+title+or+description GET /projects/:id/issues_statistics?author_id=5 GET /projects/:id/issues_statistics?assignee_id=5 GET /projects/:id/issues_statistics?my_reaction_emoji=star GET /projects/:id/issues_statistics?confidential=true ``` | Attribute | Type | Required | Description | | --- | --- | --- | --- | | `id` | integer/string | yes | 经过身份验证的用户拥有[的项目](README.html#namespaced-path-encoding)的 ID 或[URL 编码路径](README.html#namespaced-path-encoding) | | `iids[]` | 整数数组 | no | 仅返回具有给定`iid`的里程碑 | | `labels` | string | no | 标签名称的逗号分隔列表,必须具有要返回的所有标签的问题. `None`列出所有没有标签的问题. `Any`列出至少带有一个标签的所有问题. | | `milestone` | string | no | 里程碑标题. `None`列出没有里程碑的所有问题. `Any`列出具有指定里程碑的所有问题. | | `scope` | string | no | 回到问题在给定范围: `created_by_me` , `assigned_to_me`或`all` . | | `author_id` | integer | no | 返回由给定用户`id`创建的问题. 与`author_username` . 与`scope=all`或`scope=assigned_to_me`结合使用. | | `author_username` | string | no | 返回由给定`username`创建的问题. 类似于`author_id`并且与`author_id` . | | `assignee_id` | integer | no | 返回分配给给定用户`id` . 互斥与`assignee_username` . `None`返回未分配的问题. 受让人有`Any`退货问题. | | `assignee_username` | 字符串数组 | no | 返回分配给给定`username` . 类似于`assignee_id`并且与`assignee_id`互斥. 在 GitLab CE 中, `assignee_username`数组应仅包含单个值,否则将返回无效的参数错误. | | `my_reaction_emoji` | string | no | 返回的问题由已验证的用户通过给定的`emoji`响应. `None`返回没有响应的问题. 至少有一个反应, `Any`回报问题. | | `search` | string | no | 根据`title`和`description`搜索项目问题 | | `created_after` | datetime | no | Return issues created on or after the given time | | `created_before` | datetime | no | 返回在给定时间或之前创建的问题 | | `updated_after` | datetime | no | 返回在给定时间或之后更新的问题 | | `updated_before` | datetime | no | 返回在给定时间或之前更新的问题 | | `confidential` | boolean | no | 过滤机密或公共问题. | ``` curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues_statistics" ``` 响应示例: ``` { "statistics": { "counts": { "all": 20, "closed": 5, "opened": 15 } } } ```