议题统计 API
- Tier: 基础版, 专业版, 旗舰版
- Offering: JihuLab.com, 私有化部署
每次调用 议题 统计 API 都必须经过认证。
如果用户不是项目的成员并且项目是私有的,那么对该项目进行 GET 请求会返回 404 状态码。
获取议题统计
获取认证用户有权限访问的所有议题的统计数据。默认情况下,它只返回当前用户创建的议题。要获取所有议题,请使用参数 scope=all。
plaintext1GET /issues_statistics 2GET /issues_statistics?labels=foo 3GET /issues_statistics?labels=foo,bar 4GET /issues_statistics?labels=foo,bar&state=opened 5GET /issues_statistics?milestone=1.0.0 6GET /issues_statistics?milestone=1.0.0&state=opened 7GET /issues_statistics?iids[]=42&iids[]=43 8GET /issues_statistics?author_id=5 9GET /issues_statistics?assignee_id=5 10GET /issues_statistics?my_reaction_emoji=star 11GET /issues_statistics?search=foo&in=title 12GET /issues_statistics?confidential=true
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| 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 | 返回分配给给定用户 id 的议题。与 assignee_username 互斥。None 返回未分配的议题。Any 返回有分配者的议题。 |
| assignee_username | string array | no | 返回分配给给定 username 的议题。类似于 assignee_id,与 assignee_id 互斥。在极狐GitLab 基础版中,assignee_username 数组应该只包含一个值,否则会返回无效参数错误。 |
| epic_id | integer | no | 返回与给定史诗 ID 相关联的议题。None 返回没有与史诗关联的议题。Any 返回与史诗关联的议题。专业版和旗舰版专有。 |
| my_reaction_emoji | string | no | 返回由认证用户通过给定 emoji 反应的议题。None 返回未给出反应的议题。Any 返回至少给出一个反应的议题。 |
| iids[] | integer array | no | 仅返回拥有给定 iid 的议题 |
| search | string | no | 在议题的 title 和 description 中搜索议题 |
| in | string | no | 修改 search 属性的范围。title、description 或用逗号连接它们的字符串。默认是 title,description |
| created_after | datetime | no | 返回在给定时间或之后创建的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| created_before | datetime | no | 返回在给定时间或之前创建的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| updated_after | datetime | no | 返回在给定时间或之后更新的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| updated_before | datetime | no | 返回在给定时间或之前更新的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| confidential | boolean | no | 过滤机密或公开的议题。 |
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/issues_statistics"
示例响应:
json1{ 2 "statistics": { 3 "counts": { 4 "all": 20, 5 "closed": 5, 6 "opened": 15 7 } 8 } 9}
获取群组议题统计
获取给定群组的议题统计数据。
plaintext1GET /groups/:id/issues_statistics 2GET /groups/:id/issues_statistics?labels=foo 3GET /groups/:id/issues_statistics?labels=foo,bar 4GET /groups/:id/issues_statistics?labels=foo,bar&state=opened 5GET /groups/:id/issues_statistics?milestone=1.0.0 6GET /groups/:id/issues_statistics?milestone=1.0.0&state=opened 7GET /groups/:id/issues_statistics?iids[]=42&iids[]=43 8GET /groups/:id/issues_statistics?search=issue+title+or+description 9GET /groups/:id/issues_statistics?author_id=5 10GET /groups/:id/issues_statistics?assignee_id=5 11GET /groups/:id/issues_statistics?my_reaction_emoji=star 12GET /groups/:id/issues_statistics?confidential=true
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | yes | 群组的 ID 或 URL 编码的群组路径 |
| labels | string | no | 以逗号分隔的标签名称列表,议题必须拥有所有标签才能被返回。None 列出所有没有标签的议题。Any 列出至少拥有一个标签的议题。 |
| iids[] | integer array | 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 | string array | no | 返回分配给给定 username 的议题。类似于 assignee_id,与 assignee_id 互斥。在极狐GitLab 基础版中,assignee_username 数组应该只包含一个值,否则会返回无效参数错误。 |
| my_reaction_emoji | string | no | 返回由认证用户通过给定 emoji 反应的议题。None 返回未给出反应的议题。Any 返回至少给出一个反应的议题。 |
| search | string | no | 在群组议题的 title 和 description 中搜索议题 |
| created_after | datetime | no | 返回在给定时间或之后创建的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| created_before | datetime | no | 返回在给定时间或之前创建的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| updated_after | datetime | no | 返回在给定时间或之后更新的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| updated_before | datetime | no | 返回在给定时间或之前更新的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| confidential | boolean | no | 过滤机密或公开的议题。 |
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/4/issues_statistics"
示例响应:
json1{ 2 "statistics": { 3 "counts": { 4 "all": 20, 5 "closed": 5, 6 "opened": 15 7 } 8 } 9}
获取项目议题统计
获取给定项目的议题统计数据。
plaintext1GET /projects/:id/issues_statistics 2GET /projects/:id/issues_statistics?labels=foo 3GET /projects/:id/issues_statistics?labels=foo,bar 4GET /projects/:id/issues_statistics?labels=foo,bar&state=opened 5GET /projects/:id/issues_statistics?milestone=1.0.0 6GET /projects/:id/issues_statistics?milestone=1.0.0&state=opened 7GET /projects/:id/issues_statistics?iids[]=42&iids[]=43 8GET /projects/:id/issues_statistics?search=issue+title+or+description 9GET /projects/:id/issues_statistics?author_id=5 10GET /projects/:id/issues_statistics?assignee_id=5 11GET /projects/:id/issues_statistics?my_reaction_emoji=star 12GET /projects/:id/issues_statistics?confidential=true
| 属性 | 类型 | 必需 | 描述 |
|---|---|---|---|
| id | integer/string | yes | 项目的 ID 或 URL 编码的项目路径 |
| iids[] | integer array | 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 | string array | no | 返回分配给给定 username 的议题。类似于 assignee_id,与 assignee_id 互斥。在极狐GitLab 基础版中,assignee_username 数组应该只包含一个值,否则会返回无效参数错误。 |
| my_reaction_emoji | string | no | 返回由认证用户通过给定 emoji 反应的议题。None 返回未给出反应的议题。Any 返回至少给出一个反应的议题。 |
| search | string | no | 在项目议题的 title 和 description 中搜索议题 |
| created_after | datetime | no | 返回在给定时间或之后创建的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| created_before | datetime | no | 返回在给定时间或之前创建的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| updated_after | datetime | no | 返回在给定时间或之后更新的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| updated_before | datetime | no | 返回在给定时间或之前更新的议题。期望格式为 ISO 8601 (2019-03-15T08:00:00Z) |
| confidential | boolean | no | 过滤机密或公开的议题。 |
shellcurl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues_statistics"
示例响应:
json1{ 2 "statistics": { 3 "counts": { 4 "all": 20, 5 "closed": 5, 6 "opened": 15 7 } 8 } 9}