Issues API

原文:https://docs.gitlab.com/ee/api/issues.html

Issues API

如果用户不是项目成员,并且该项目是私有项目,则对该项目的GET请求将产生404状态代码.

Issues pagination

默认情况下,因为 API 结果是分页的,所以GET请求一次返回 20 个结果.

阅读有关分页的更多信息.

弃用:不建议使用响应中的reference属性,而推荐使用references . >推出了GitLab 12.6注意: > references.relative相对于正在请求问题的组/项目. 从其项目中获取问题时> relative格式将与short格式相同,并且在跨组/项目进行请求时, relative格式将与full格式相同.

List issues

获取经过身份验证的用户有权访问的所有问题. 默认情况下,它仅返回当前用户创建的问题. 要获取所有问题,请使用参数scope=all .

  1. GET /issues
  2. GET /issues?state=opened
  3. GET /issues?state=closed
  4. GET /issues?labels=foo
  5. GET /issues?labels=foo,bar
  6. GET /issues?labels=foo,bar&state=opened
  7. GET /issues?milestone=1.0.0
  8. GET /issues?milestone=1.0.0&state=opened
  9. GET /issues?iids[]=42&iids[]=43
  10. GET /issues?author_id=5
  11. GET /issues?assignee_id=5
  12. GET /issues?my_reaction_emoji=star
  13. GET /issues?search=foo&in=title
  14. GET /issues?confidential=true
Attribute Type Required Description
state string no 返回all问题,或者仅返回已openedclosed
labels string no Comma-separated list of label names, issues must have all labels to be returned. None lists all issues with no labels. Any lists all issues with at least one label. No+Label (Deprecated) lists all issues with no labels. Predefined names are case-insensitive.
with_labels_details boolean no 如果为true ,则响应将为标签字段中的每个标签返回更多详细信息:name:color:description:description_html:text_color . 默认值为false . GitLab 12.7中引入了description_html属性
milestone string no 里程碑标题. None列出没有里程碑的所有问题. Any列出具有指定里程碑的所有问题.
scope string no 回到问题在给定范围: created_by_meassigned_to_meall . 默认为created_by_me

对于 11.0 之前的版本,请改用现在不建议使用created-by-me范围或created-by-me assigned-to-me范围. (在 GitLab 9.5 中引入 .在 GitLab 11.0 中更改为 snake_case | | author_id | integer | no | 返回由给定用户id创建的问题. 与author_username . 与scope=allscope=assigned_to_me结合使用. (在 GitLab 9.5 中引入 | | author_username | string | no | 返回由给定username创建的问题. 类似于author_id并且与author_id . | | assignee_id | integer | no | 返回分配给给定用户id . 互斥与assignee_username . None返回未分配的问题. 受让人有Any退货问题. (在 GitLab 9.5 中引入 | | assignee_username | 字符串数组 | no | 返回分配给给定username . 类似于assignee_id并且与assignee_id互斥. 在 GitLab CE 中, assignee_username数组应仅包含单个值,否则将返回无效的参数错误. | | my_reaction_emoji | string | no | 返回的问题由已验证的用户通过给定的emoji响应. None返回没有响应的问题. 至少有一个反应, Any回报问题. (在 GitLab 10.0 中引入 | | weight | integer | no | 以指定的weight返回问题. None返回没有分配权重的问题. 分配了权重的Any退货问题. | | iids[] | 整数数组 | no | 仅返回具有给定iid的问题 | | order_by | string | no | 回到问题下令created_atupdated_atprioritydue_daterelative_positionlabel_prioritymilestone_duepopularityweight领域. 默认为created_at | | sort | string | no | 返回按ascdesc排列的问题. 默认为desc | | search | string | no | 根据titledescription搜索问题 | | in | string | no | 修改search属性的范围. titledescription或以逗号将它们连接在一起的字符串. 默认为title,description | | created_after | datetime | no | 返回在给定时间或之后创建的问题 | | created_before | datetime | no | 返回在给定时间或之前创建的问题 | | updated_after | datetime | no | 返回在给定时间或之后更新的问题 | | updated_before | datetime | no | 返回在给定时间或之前更新的问题 | | confidential | boolean | no | 过滤机密或公共问题. | | not | Hash | no | 返回与提供的参数不匹配的问题. 接受: labelsmilestoneauthor_idauthor_usernameassignee_idassignee_usernamemy_reaction_emoji | | non_archived | boolean | no | 仅从未归档的项目返回问题. 如果为false ,则响应将返回已归档和未归档项目中的问题. 默认值为true . (在GitLab 13.0 中引入) |

  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/issues"

响应示例:

  1. [ { "state" : "opened", "description" : "Ratione dolores corrupti mollitia soluta quia.", "author" : { "state" : "active", "id" : 18, "web_url" : "https://gitlab.example.com/eileen.lowe", "name" : "Alexandra Bashirian", "avatar_url" : null, "username" : "eileen.lowe" }, "milestone" : { "project_id" : 1, "description" : "Ducimus nam enim ex consequatur cumque ratione.", "state" : "closed", "due_date" : null, "iid" : 2, "created_at" : "2016-01-04T15:31:39.996Z", "title" : "v4.0", "id" : 17, "updated_at" : "2016-01-04T15:31:39.996Z" }, "project_id" : 1, "assignees" : [{ "state" : "active", "id" : 1, "name" : "Administrator", "web_url" : "https://gitlab.example.com/root", "avatar_url" : null, "username" : "root" }], "assignee" : { "state" : "active", "id" : 1, "name" : "Administrator", "web_url" : "https://gitlab.example.com/root", "avatar_url" : null, "username" : "root" }, "updated_at" : "2016-01-04T15:31:51.081Z", "closed_at" : null, "closed_by" : null, "id" : 76, "title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.", "created_at" : "2016-01-04T15:31:51.081Z", "moved_to_id" : null, "iid" : 6, "labels" : ["foo", "bar"], "upvotes": 4, "downvotes": 0, "merge_requests_count": 0, "user_notes_count": 1, "due_date": "2016-07-22", "web_url": "http://example.com/my-group/my-project/issues/6", "references": { "short": "#6", "relative": "my-group/my-project#6", "full": "my-group/my-project#6" }, "time_stats": { "time_estimate": 0, "total_time_spent": 0, "human_time_estimate": null, "human_total_time_spent": null }, "has_tasks": true, "task_status": "10 of 15 tasks completed", "confidential": false, "discussion_locked": false, "_links":{ "self":"http://example.com/api/v4/projects/1/issues/76", "notes":"`http://example.com/`api/v4/projects/1/issues/76/notes", "award_emoji":"http://example.com/api/v4/projects/1/issues/76/award_emoji", "project":"http://example.com/api/v4/projects/1" }, "task_completion_status":{ "count":0, "completed_count":0 } } ]

使用 GitLab Starter,Bronze 或更高版本的用户还将看到weight参数:

  1. [ { "state" : "opened", "description" : "Ratione dolores corrupti mollitia soluta quia.", "weight": null, ... } ]

注意 :不建议使用assignee列,现在我们将其显示为符合 GitLab EE API 的单一大小的数组assignees .

注意GitLab 10.6引入了 closed_by属性. 只有在 GitLab 10.6 之后关闭的问题以及关闭问题的用户帐户仍然存在时,才会显示此值.

List group issues

获取小组问题的列表.

如果该组是私有的,则需要提供凭据进行授权. 首选的方法是使用个人访问令牌 .

  1. GET /groups/:id/issues
  2. GET /groups/:id/issues?state=opened
  3. GET /groups/:id/issues?state=closed
  4. GET /groups/:id/issues?labels=foo
  5. GET /groups/:id/issues?labels=foo,bar
  6. GET /groups/:id/issues?labels=foo,bar&state=opened
  7. GET /groups/:id/issues?milestone=1.0.0
  8. GET /groups/:id/issues?milestone=1.0.0&state=opened
  9. GET /groups/:id/issues?iids[]=42&iids[]=43
  10. GET /groups/:id/issues?search=issue+title+or+description
  11. GET /groups/:id/issues?author_id=5
  12. GET /groups/:id/issues?assignee_id=5
  13. GET /groups/:id/issues?my_reaction_emoji=star
  14. GET /groups/:id/issues?confidential=true
Attribute Type Required Description
id integer/string yes 认证用户拥有的组的 ID 或URL 编码路径
state string no 返回所有问题,或者仅返回已openedclosed
labels string no 标签名称的逗号分隔列表,必须具有要返回的所有标签的问题. None列出所有没有标签的问题. Any列出至少带有一个标签的所有问题. No+Label (不推荐使用)列出所有问题且不带标签. 预定义名称不区分大小写.
with_labels_details boolean no 如果为true ,则响应将为标签字段中的每个标签返回更多详细信息:name:color:description:description_html:text_color . 默认值为false . GitLab 12.7中引入了description_html属性
iids[] 整数数组 no 仅返回具有给定iid的问题
milestone string no 里程碑标题. None列出没有里程碑的所有问题. Any列出具有指定里程碑的所有问题.
scope string no 回到问题在给定范围: created_by_meassigned_to_meall .

对于 11.0 之前的版本,请改用现在不建议使用created-by-me范围或created-by-me assigned-to-me范围. (在 GitLab 9.5 中引入 .在 GitLab 11.0 中更改为 snake_case | | author_id | integer | no | 返回由给定用户id创建的问题. 与author_username . 与scope=allscope=assigned_to_me结合使用. (在 GitLab 9.5 中引入 | | author_username | string | no | 返回由给定username创建的问题. 类似于author_id并且与author_id . | | assignee_id | integer | no | 返回分配给给定用户id . 互斥与assignee_username . None返回未分配的问题. 受让人有Any退货问题. (在 GitLab 9.5 中引入 | | assignee_username | 字符串数组 | no | 返回分配给给定username . 类似于assignee_id并且与assignee_id互斥. 在 GitLab CE 中, assignee_username数组应仅包含单个值,否则将返回无效的参数错误. | | my_reaction_emoji | string | no | 返回的问题由已验证的用户通过给定的emoji响应. None返回没有响应的问题. 至少有一个反应, Any回报问题. (在 GitLab 10.0 中引入 | | weight | integer | no | 以指定的weight返回问题. None返回没有分配权重的问题. 分配了权重的Any退货问题. | | order_by | string | no | 回到问题下令created_atupdated_atprioritydue_daterelative_positionlabel_prioritymilestone_duepopularityweight领域. 默认为created_at | | sort | string | no | 返回按ascdesc排列的问题. 默认为desc | | search | string | no | 搜索组问题的titledescription | | created_after | datetime | no | 返回在给定时间或之后创建的问题 | | created_before | datetime | no | 返回在给定时间或之前创建的问题 | | updated_after | datetime | no | 返回在给定时间或之后更新的问题 | | updated_before | datetime | no | 返回在给定时间或之前更新的问题 | | confidential | boolean | no | 过滤机密或公共问题. | | not | Hash | no | 返回与提供的参数不匹配的问题. 接受: labelsmilestoneauthor_idauthor_usernameassignee_idassignee_usernamemy_reaction_emojisearchin | | non_archived | boolean | no | 从未归档的项目返回问题. 默认为 true. (在GitLab 12.8 中引入) |

  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/4/issues"

响应示例:

  1. [ { "project_id" : 4, "milestone" : { "due_date" : null, "project_id" : 4, "state" : "closed", "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.", "iid" : 3, "id" : 11, "title" : "v3.0", "created_at" : "2016-01-04T15:31:39.788Z", "updated_at" : "2016-01-04T15:31:39.788Z" }, "author" : { "state" : "active", "web_url" : "https://gitlab.example.com/root", "avatar_url" : null, "username" : "root", "id" : 1, "name" : "Administrator" }, "description" : "Omnis vero earum sunt corporis dolor et placeat.", "state" : "closed", "iid" : 1, "assignees" : [{ "avatar_url" : null, "web_url" : "https://gitlab.example.com/lennie", "state" : "active", "username" : "lennie", "id" : 9, "name" : "Dr. Luella Kovacek" }], "assignee" : { "avatar_url" : null, "web_url" : "https://gitlab.example.com/lennie", "state" : "active", "username" : "lennie", "id" : 9, "name" : "Dr. Luella Kovacek" }, "labels" : ["foo", "bar"], "upvotes": 4, "downvotes": 0, "merge_requests_count": 0, "id" : 41, "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.", "updated_at" : "2016-01-04T15:31:46.176Z", "created_at" : "2016-01-04T15:31:46.176Z", "closed_at" : null, "closed_by" : null, "user_notes_count": 1, "due_date": null, "web_url": "http://example.com/my-group/my-project/issues/1", "references": { "short": "#1", "relative": "my-project#1", "full": "my-group/my-project#1" }, "time_stats": { "time_estimate": 0, "total_time_spent": 0, "human_time_estimate": null, "human_total_time_spent": null }, "has_tasks": true, "task_status": "10 of 15 tasks completed", "confidential": false, "discussion_locked": false, "_links":{ "self":"http://example.com/api/v4/projects/4/issues/41", "notes":"`http://example.com/`api/v4/projects/4/issues/41/notes", "award_emoji":"http://example.com/api/v4/projects/4/issues/41/award_emoji", "project":"http://example.com/api/v4/projects/4" }, "task_completion_status":{ "count":0, "completed_count":0 } } ]

Users on GitLab Starter, Bronze, or higher will also see the weight parameter:

  1. [ { "project_id" : 4, "description" : "Omnis vero earum sunt corporis dolor et placeat.", "weight": null, ... } ]

注意 :不建议使用assignee列,现在我们将其显示为符合 GitLab EE API 的单一大小的数组assignees .

注意GitLab 10.6引入了 closed_by属性. 只有在 GitLab 10.6 之后关闭的问题以及关闭问题的用户帐户仍然存在时,才会显示此值.

List project issues

Get a list of a project’s issues.

如果项目为私人项目,则需要提供凭据进行授权. 首选的方法是使用个人访问令牌 .

  1. GET /projects/:id/issues
  2. GET /projects/:id/issues?state=opened
  3. GET /projects/:id/issues?state=closed
  4. GET /projects/:id/issues?labels=foo
  5. GET /projects/:id/issues?labels=foo,bar
  6. GET /projects/:id/issues?labels=foo,bar&state=opened
  7. GET /projects/:id/issues?milestone=1.0.0
  8. GET /projects/:id/issues?milestone=1.0.0&state=opened
  9. GET /projects/:id/issues?iids[]=42&iids[]=43
  10. GET /projects/:id/issues?search=issue+title+or+description
  11. GET /projects/:id/issues?author_id=5
  12. GET /projects/:id/issues?assignee_id=5
  13. GET /projects/:id/issues?my_reaction_emoji=star
  14. GET /projects/:id/issues?confidential=true
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
iids[] 整数数组 no 仅返回具有给定iid的问题
state string no 返回所有问题,或者仅返回已openedclosed
labels string no 标签名称的逗号分隔列表,必须具有要返回的所有标签的问题. None列出所有没有标签的问题. Any列出至少带有一个标签的所有问题. No+Label (不推荐使用)列出所有问题且不带标签. 预定义名称不区分大小写.
with_labels_details boolean no 如果为true ,则响应将为标签字段中的每个标签返回更多详细信息:name:color:description:description_html:text_color . 默认值为false . description_htmlGitLab 12.7 中引入
milestone string no 里程碑标题. None列出没有里程碑的所有问题. Any列出具有指定里程碑的所有问题.
scope string no 回到问题在给定范围: created_by_meassigned_to_meall .

对于 11.0 之前的版本,请改用现在不建议使用created-by-me范围或created-by-me assigned-to-me范围. (在 GitLab 9.5 中引入 .在 GitLab 11.0 中更改为 snake_case | | author_id | integer | no | 返回由给定用户id创建的问题. 与author_username . 与scope=allscope=assigned_to_me结合使用. (在 GitLab 9.5 中引入 | | author_username | string | no | 返回由给定username创建的问题. 类似于author_id并且与author_id . | | assignee_id | integer | no | 返回分配给给定用户id . 互斥与assignee_username . None返回未分配的问题. 受让人有Any退货问题. (在 GitLab 9.5 中引入 | | assignee_username | 字符串数组 | no | 返回分配给给定username . 类似于assignee_id并且与assignee_id互斥. 在 GitLab CE 中, assignee_username数组应仅包含单个值,否则将返回无效的参数错误. | | my_reaction_emoji | string | no | 返回的问题由已验证的用户通过给定的emoji响应. None返回没有响应的问题. 至少有一个反应, Any回报问题. (在 GitLab 10.0 中引入 | | weight | integer | no | 以指定的weight返回问题. None返回没有分配权重的问题. 分配了权重的Any退货问题. | | order_by | string | no | 回到问题下令created_atupdated_atprioritydue_daterelative_positionlabel_prioritymilestone_duepopularityweight领域. 默认为created_at | | sort | string | no | 返回按ascdesc排列的问题. 默认为desc | | search | string | no | 根据titledescription搜索项目问题 | | created_after | datetime | no | 返回在给定时间或之后创建的问题 | | created_before | datetime | no | 返回在给定时间或之前创建的问题 | | updated_after | datetime | no | 返回在给定时间或之后更新的问题 | | updated_before | datetime | no | 返回在给定时间或之前更新的问题 | | confidential | boolean | no | 过滤机密或公共问题. | | not | Hash | no | 返回与提供的参数不匹配的问题. 接受: labelsmilestoneauthor_idauthor_usernameassignee_idassignee_usernamemy_reaction_emojisearchin |

  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues"

响应示例:

  1. [ { "project_id" : 4, "milestone" : { "due_date" : null, "project_id" : 4, "state" : "closed", "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.", "iid" : 3, "id" : 11, "title" : "v3.0", "created_at" : "2016-01-04T15:31:39.788Z", "updated_at" : "2016-01-04T15:31:39.788Z" }, "author" : { "state" : "active", "web_url" : "https://gitlab.example.com/root", "avatar_url" : null, "username" : "root", "id" : 1, "name" : "Administrator" }, "description" : "Omnis vero earum sunt corporis dolor et placeat.", "state" : "closed", "iid" : 1, "assignees" : [{ "avatar_url" : null, "web_url" : "https://gitlab.example.com/lennie", "state" : "active", "username" : "lennie", "id" : 9, "name" : "Dr. Luella Kovacek" }], "assignee" : { "avatar_url" : null, "web_url" : "https://gitlab.example.com/lennie", "state" : "active", "username" : "lennie", "id" : 9, "name" : "Dr. Luella Kovacek" }, "labels" : ["foo", "bar"], "upvotes": 4, "downvotes": 0, "merge_requests_count": 0, "id" : 41, "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.", "updated_at" : "2016-01-04T15:31:46.176Z", "created_at" : "2016-01-04T15:31:46.176Z", "closed_at" : "2016-01-05T15:31:46.176Z", "closed_by" : { "state" : "active", "web_url" : "https://gitlab.example.com/root", "avatar_url" : null, "username" : "root", "id" : 1, "name" : "Administrator" }, "user_notes_count": 1, "due_date": "2016-07-22", "web_url": "http://example.com/my-group/my-project/issues/1", "references": { "short": "#1", "relative": "#1", "full": "my-group/my-project#1" }, "time_stats": { "time_estimate": 0, "total_time_spent": 0, "human_time_estimate": null, "human_total_time_spent": null }, "has_tasks": true, "task_status": "10 of 15 tasks completed", "confidential": false, "discussion_locked": false, "_links":{ "self":"http://example.com/api/v4/projects/4/issues/41", "notes":"`http://example.com/`api/v4/projects/4/issues/41/notes", "award_emoji":"http://example.com/api/v4/projects/4/issues/41/award_emoji", "project":"http://example.com/api/v4/projects/4" }, "task_completion_status":{ "count":0, "completed_count":0 } } ]

使用 GitLab Starter,Bronze 或更高版本的用户还将看到weight参数:

  1. [ { "project_id" : 4, "description" : "Omnis vero earum sunt corporis dolor et placeat.", "weight": null, ... } ]

注意 :不建议使用assignee列,现在我们将其显示为符合 GitLab EE API 的单一大小的数组assignees .

注意GitLab 10.6引入了 closed_by属性. 只有在 GitLab 10.6 之后关闭的问题以及关闭问题的用户帐户仍然存在时,才会显示此值.

Single issue

获得单个项目问题.

如果项目为私人项目或问题为机密,则需要提供凭据进行授权. 首选的方法是使用个人访问令牌 .

  1. GET /projects/:id/issues/:issue_iid
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes The internal ID of a project’s issue
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues/41"

响应示例:

  1. { "project_id" : 4, "milestone" : { "due_date" : null, "project_id" : 4, "state" : "closed", "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.", "iid" : 3, "id" : 11, "title" : "v3.0", "created_at" : "2016-01-04T15:31:39.788Z", "updated_at" : "2016-01-04T15:31:39.788Z", "closed_at" : "2016-01-05T15:31:46.176Z" }, "author" : { "state" : "active", "web_url" : "https://gitlab.example.com/root", "avatar_url" : null, "username" : "root", "id" : 1, "name" : "Administrator" }, "description" : "Omnis vero earum sunt corporis dolor et placeat.", "state" : "closed", "iid" : 1, "assignees" : [{ "avatar_url" : null, "web_url" : "https://gitlab.example.com/lennie", "state" : "active", "username" : "lennie", "id" : 9, "name" : "Dr. Luella Kovacek" }], "assignee" : { "avatar_url" : null, "web_url" : "https://gitlab.example.com/lennie", "state" : "active", "username" : "lennie", "id" : 9, "name" : "Dr. Luella Kovacek" }, "labels" : [], "upvotes": 4, "downvotes": 0, "merge_requests_count": 0, "id" : 41, "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.", "updated_at" : "2016-01-04T15:31:46.176Z", "created_at" : "2016-01-04T15:31:46.176Z", "closed_at" : null, "closed_by" : null, "subscribed": false, "user_notes_count": 1, "due_date": null, "web_url": "http://example.com/my-group/my-project/issues/1", "references": { "short": "#1", "relative": "#1", "full": "my-group/my-project#1" }, "time_stats": { "time_estimate": 0, "total_time_spent": 0, "human_time_estimate": null, "human_total_time_spent": null }, "confidential": false, "discussion_locked": false, "_links": { "self": "http://example.com/api/v4/projects/1/issues/2", "notes": "http://example.com/api/v4/projects/1/issues/2/notes", "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji", "project": "http://example.com/api/v4/projects/1" }, "task_completion_status":{ "count":0, "completed_count":0 } }

使用 GitLab Starter,Bronze 或更高版本的用户还将看到weight参数:

  1. { "project_id" : 4, "description" : "Omnis vero earum sunt corporis dolor et placeat.", "weight": null, ... }

使用 GitLab Premium 的用户还将看到epic属性:

  1. {
  2. "project_id" : 4,
  3. "description" : "Omnis vero earum sunt corporis dolor et placeat.",
  4. "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute
  5. "epic": {
  6. "id" : 42,
  7. "iid" : 5,
  8. "title": "My epic epic",
  9. "url" : "/groups/h5bp/-/epics/5",
  10. "group_id": 8
  11. },
  12. // ...
  13. }

注意 :不建议使用assignee列,现在我们将其显示为符合 GitLab EE API 的单一大小的数组assignees .

注意GitLab 10.6引入了 closed_by属性. 只有在 GitLab 10.6 之后关闭的问题以及关闭问题的用户帐户仍然存在时,才会显示此值.

注意epic_iid属性已过时, 将在版本 5 中删除 . 请改用epic属性的iid .

New issue

创建一个新的项目问题.

  1. POST /projects/:id/issues
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
iid integer/string no 项目问题的内部 ID(需要管理员或项目所有者权限)
title string yes 问题标题
description string no 问题的描述. 限制为 1,048,576 个字符.
confidential boolean no 将问题设置为机密. 默认值为false .
assignee_ids 整数数组 no 要分配问题的用户的 ID
milestone_id integer no 分配问题的里程碑的全局 ID
labels string no 问题的逗号分隔标签名称
created_at string no 日期时间字符串,ISO 8601 格式,例如2016-03-11T03:45:40Z (需要管理员或项目/组所有者权限)
due_date string no 日期时间字符串,格式为 YEAR-MONTH-DAY,例如2016-03-11
merge_request_to_resolve_discussions_of integer no 解决所有问题的合并请求的 IID. 这将使用默认描述填充问题,并将所有讨论标记为已解决. 传递描述或标题时,这些值将优先于默认值.
discussion_to_resolve string no 要解决的讨论的​​ID. 这将使用默认描述填充问题,并将讨论标记为已解决. 与merge_request_to_resolve_discussions_of结合使用.
weight integer no 问题的分量. 有效值大于或等于 0.
epic_id integer no 要添加问题的史诗的 ID. 有效值大于或等于 0.
epic_iid integer no 要添加问题的史诗的 IID. 有效值大于或等于 0.(不建议使用, 将在版本 5 中将其删除
  1. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues?title=Issues%20with%20auth&labels=bug"

响应示例:

  1. { "project_id" : 4, "id" : 84, "created_at" : "2016-01-07T12:44:33.959Z", "iid" : 14, "title" : "Issues with auth", "state" : "opened", "assignees" : [], "assignee" : null, "labels" : [ "bug" ], "upvotes": 4, "downvotes": 0, "merge_requests_count": 0, "author" : { "name" : "Alexandra Bashirian", "avatar_url" : null, "state" : "active", "web_url" : "https://gitlab.example.com/eileen.lowe", "id" : 18, "username" : "eileen.lowe" }, "description" : null, "updated_at" : "2016-01-07T12:44:33.959Z", "closed_at" : null, "closed_by" : null, "milestone" : null, "subscribed" : true, "user_notes_count": 0, "due_date": null, "web_url": "http://example.com/my-group/my-project/issues/14", "references": { "short": "#14", "relative": "#14", "full": "my-group/my-project#14" }, "time_stats": { "time_estimate": 0, "total_time_spent": 0, "human_time_estimate": null, "human_total_time_spent": null }, "confidential": false, "discussion_locked": false, "_links": { "self": "http://example.com/api/v4/projects/1/issues/2", "notes": "http://example.com/api/v4/projects/1/issues/2/notes", "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji", "project": "http://example.com/api/v4/projects/1" }, "task_completion_status":{ "count":0, "completed_count":0 } }

使用 GitLab Starter,Bronze 或更高版本的用户还将看到weight参数:

  1. { "project_id" : 4, "description" : null, "weight": null, ... }

注意 :不建议使用assignee列,现在我们将其显示为符合 GitLab EE API 的单一大小的数组assignees .

注意GitLab 10.6引入了 closed_by属性. 只有在 GitLab 10.6 之后关闭的问题以及关闭问题的用户帐户仍然存在时,才会显示此值.

Rate limits

为了避免滥用,用户仅限于:

请求类型 Limit
Create 每分钟 300 期

Edit issue

更新现有项目问题. 此调用还用于将问题标记为已结束.

  1. PUT /projects/:id/issues/:issue_iid
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
title string no 问题标题
description string no 问题的描述. 限制为 1,048,576 个字符.
confidential boolean no 将问题更新为机密
assignee_ids 整数数组 no 要分配问题的用户的 ID. 设置为0或提供一个空值以取消分配所有受让人.
milestone_id integer no 要分配问题的里程碑的全局 ID. 设置为0或提供一个空值以取消分配里程碑.
labels string no 问题的标签名称,以逗号分隔. 设置为空字符串以取消分配所有标签.
add_labels string no 以逗号分隔的标签名称添加到问题中.
remove_labels string no 逗号分隔的标签名称可从问题中删除.
state_event string no 问题的状态事件. 设为close以关闭问题,然后reopen以重新打开它
updated_at string no 日期时间字符串,ISO 8601 格式,例如2016-03-11T03:45:40Z (需要管理员或项目所有者权限). 不接受空字符串或空值.
due_date string no 日期时间字符串,格式为 YEAR-MONTH-DAY,例如2016-03-11
weight integer no 问题的分量. 有效值大于或等于 0.0
discussion_locked boolean no 指示问题的讨论是否被锁定的标志. 如果讨论被锁定,则只有项目成员可以添加或编辑评论.
epic_id integer no 要添加问题的史诗的 ID. 有效值大于或等于 0.
epic_iid integer no 要添加问题的史诗的 IID. 有效值大于或等于 0.(不建议使用, 将在版本 5 中将其删除
  1. curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues/85?state_event=close"

响应示例:

  1. { "created_at" : "2016-01-07T12:46:01.410Z", "author" : { "name" : "Alexandra Bashirian", "avatar_url" : null, "username" : "eileen.lowe", "id" : 18, "state" : "active", "web_url" : "https://gitlab.example.com/eileen.lowe" }, "state" : "closed", "title" : "Issues with auth", "project_id" : 4, "description" : null, "updated_at" : "2016-01-07T12:55:16.213Z", "closed_at" : "2016-01-08T12:55:16.213Z", "closed_by" : { "state" : "active", "web_url" : "https://gitlab.example.com/root", "avatar_url" : null, "username" : "root", "id" : 1, "name" : "Administrator" }, "iid" : 15, "labels" : [ "bug" ], "upvotes": 4, "downvotes": 0, "merge_requests_count": 0, "id" : 85, "assignees" : [], "assignee" : null, "milestone" : null, "subscribed" : true, "user_notes_count": 0, "due_date": "2016-07-22", "web_url": "http://example.com/my-group/my-project/issues/15", "references": { "short": "#15", "relative": "#15", "full": "my-group/my-project#15" }, "time_stats": { "time_estimate": 0, "total_time_spent": 0, "human_time_estimate": null, "human_total_time_spent": null }, "confidential": false, "discussion_locked": false, "_links": { "self": "http://example.com/api/v4/projects/1/issues/2", "notes": "http://example.com/api/v4/projects/1/issues/2/notes", "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji", "project": "http://example.com/api/v4/projects/1" }, "task_completion_status":{ "count":0, "completed_count":0 } }

使用 GitLab Starter,Bronze 或更高版本的用户还将看到weight参数:

  1. { "project_id" : 4, "description" : null, "weight": null, ... }

注:至少以下参数之一是需要传递的请求是成功的: :assignee_id:assignee_ids:confidential:created_at:description:discussion_locked:due_date:labels:milestone_id:state_event ,或:title .注意:不建议使用assignee列. 现在,我们将其显示为符合 GitLab EE API 的单个大小的数组assignees .注意: closed_by属性是在 GitLab 10.6引入的 . 只有在 GitLab 10.6 之后关闭的问题以及关闭问题的用户帐户仍然存在时,才会显示此值.

Delete an issue

仅适用于管理员和项目所有者. 删除相关问题.

  1. DELETE /projects/:id/issues/:issue_iid
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
  1. curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues/85"

Reorder an issue

作为社区贡献 引入到 GitLab 13.2 中.

重新排序问题,手动排序问题时可以看到结果

  1. PUT /projects/:id/issues/:issue_iid/reorder
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
move_after_id integer no 一个项目的 ID,以便在以后移动此问题
move_before_id integer no 一个项目的 ID,以便在此之前移此问题
  1. curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues/85/reorder?move_after_id=51&move_before_id=92"

Move an issue

将问题移到其他项目. 如果目标项目等于源项目,或者用户没有足够的权限来移动问题,则返回错误400和解释性错误消息.

If a given label and/or milestone with the same name also exists in the target project, it will then be assigned to the issue that is being moved.

  1. POST /projects/:id/issues/:issue_iid/move
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
to_project_id integer yes 新项目的 ID
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" --form to_project_id=5 "https://gitlab.example.com/api/v4/projects/4/issues/85/move"

Example response:

  1. { "id": 92, "iid": 11, "project_id": 5, "title": "Sit voluptas tempora quisquam aut doloribus et.", "description": "Repellat voluptas quibusdam voluptatem exercitationem.", "state": "opened", "created_at": "2016-04-05T21:41:45.652Z", "updated_at": "2016-04-07T12:20:17.596Z", "closed_at": null, "closed_by": null, "labels": [], "upvotes": 4, "downvotes": 0, "merge_requests_count": 0, "milestone": null, "assignees": [{ "name": "Miss Monserrate Beier", "username": "axel.block", "id": 12, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon", "web_url": "https://gitlab.example.com/axel.block" }], "assignee": { "name": "Miss Monserrate Beier", "username": "axel.block", "id": 12, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon", "web_url": "https://gitlab.example.com/axel.block" }, "author": { "name": "Kris Steuber", "username": "solon.cremin", "id": 10, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon", "web_url": "https://gitlab.example.com/solon.cremin" }, "due_date": null, "web_url": "http://example.com/my-group/my-project/issues/11", "references": { "short": "#11", "relative": "#11", "full": "my-group/my-project#11" }, "time_stats": { "time_estimate": 0, "total_time_spent": 0, "human_time_estimate": null, "human_total_time_spent": null }, "confidential": false, "discussion_locked": false, "_links": { "self": "http://example.com/api/v4/projects/1/issues/2", "notes": "http://example.com/api/v4/projects/1/issues/2/notes", "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji", "project": "http://example.com/api/v4/projects/1" }, "task_completion_status":{ "count":0, "completed_count":0 } }

使用 GitLab Starter,Bronze 或更高版本的用户还将看到weight参数:

  1. { "project_id": 5, "description": "Repellat voluptas quibusdam voluptatem exercitationem.", "weight": null, ... }

注意 :不建议使用assignee列,现在我们将其显示为符合 GitLab EE API 的单一大小的数组assignees .

注意GitLab 10.6引入了 closed_by属性. 只有在 GitLab 10.6 之后关闭的问题以及关闭问题的用户帐户仍然存在时,才会显示此值.

Subscribe to an issue

为经过身份验证的用户订阅问题以接收通知. 如果用户已经订阅了该问题,则返回状态码304 .

  1. POST /projects/:id/issues/:issue_iid/subscribe
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
  1. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/93/subscribe"

响应示例:

  1. { "id": 92, "iid": 11, "project_id": 5, "title": "Sit voluptas tempora quisquam aut doloribus et.", "description": "Repellat voluptas quibusdam voluptatem exercitationem.", "state": "opened", "created_at": "2016-04-05T21:41:45.652Z", "updated_at": "2016-04-07T12:20:17.596Z", "closed_at": null, "closed_by": null, "labels": [], "upvotes": 4, "downvotes": 0, "merge_requests_count": 0, "milestone": null, "assignees": [{ "name": "Miss Monserrate Beier", "username": "axel.block", "id": 12, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon", "web_url": "https://gitlab.example.com/axel.block" }], "assignee": { "name": "Miss Monserrate Beier", "username": "axel.block", "id": 12, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon", "web_url": "https://gitlab.example.com/axel.block" }, "author": { "name": "Kris Steuber", "username": "solon.cremin", "id": 10, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon", "web_url": "https://gitlab.example.com/solon.cremin" }, "due_date": null, "web_url": "http://example.com/my-group/my-project/issues/11", "references": { "short": "#11", "relative": "#11", "full": "my-group/my-project#11" }, "time_stats": { "time_estimate": 0, "total_time_spent": 0, "human_time_estimate": null, "human_total_time_spent": null }, "confidential": false, "discussion_locked": false, "_links": { "self": "http://example.com/api/v4/projects/1/issues/2", "notes": "http://example.com/api/v4/projects/1/issues/2/notes", "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji", "project": "http://example.com/api/v4/projects/1" }, "task_completion_status":{ "count":0, "completed_count":0 } }

使用 GitLab Starter,Bronze 或更高版本的用户还将看到weight参数:

  1. { "project_id": 5, "description": "Repellat voluptas quibusdam voluptatem exercitationem.", "weight": null, ... }

注意 :不建议使用assignee列,现在我们将其显示为符合 GitLab EE API 的单一大小的数组assignees .

注意GitLab 10.6引入了 closed_by属性. 只有在 GitLab 10.6 之后关闭的问题以及关闭问题的用户帐户仍然存在时,才会显示此值.

Unsubscribe from an issue

从问题中退订已认证的用户,以不接收来自该问题的通知. 如果用户未订阅该问题,则返回状态码304 .

  1. POST /projects/:id/issues/:issue_iid/unsubscribe
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
  1. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/93/unsubscribe"

响应示例:

  1. { "id": 93, "iid": 12, "project_id": 5, "title": "Incidunt et rerum ea expedita iure quibusdam.", "description": "Et cumque architecto sed aut ipsam.", "state": "opened", "created_at": "2016-04-05T21:41:45.217Z", "updated_at": "2016-04-07T13:02:37.905Z", "labels": [], "upvotes": 4, "downvotes": 0, "merge_requests_count": 0, "milestone": null, "assignee": { "name": "Edwardo Grady", "username": "keyon", "id": 21, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/3e6f06a86cf27fa8b56f3f74f7615987?s=80&d=identicon", "web_url": "https://gitlab.example.com/keyon" }, "closed_at": null, "closed_by": null, "author": { "name": "Vivian Hermann", "username": "orville", "id": 11, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/5224fd70153710e92fb8bcf79ac29d67?s=80&d=identicon", "web_url": "https://gitlab.example.com/orville" }, "subscribed": false, "due_date": null, "web_url": "http://example.com/my-group/my-project/issues/12", "references": { "short": "#12", "relative": "#12", "full": "my-group/my-project#12" }, "confidential": false, "discussion_locked": false, "task_completion_status":{ "count":0, "completed_count":0 } }

Create a todo

在问题上为当前用户手动创建待办事项. 如果在该问题上已经存在用户的待办事项,则返回状态码304 .

  1. POST /projects/:id/issues/:issue_iid/todo
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
  1. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/93/todo"

响应示例:

  1. { "id": 112, "project": { "id": 5, "name": "GitLab CI/CD", "name_with_namespace": "GitLab Org / GitLab CI/CD", "path": "gitlab-ci", "path_with_namespace": "gitlab-org/gitlab-ci" }, "author": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" }, "action_name": "marked", "target_type": "Issue", "target": { "id": 93, "iid": 10, "project_id": 5, "title": "Vel voluptas atque dicta mollitia adipisci qui at.", "description": "Tempora laboriosam sint magni sed voluptas similique.", "state": "closed", "created_at": "2016-06-17T07:47:39.486Z", "updated_at": "2016-07-01T11:09:13.998Z", "labels": [], "milestone": { "id": 26, "iid": 1, "project_id": 5, "title": "v0.0", "description": "Accusantium nostrum rerum quae quia quis nesciunt suscipit id.", "state": "closed", "created_at": "2016-06-17T07:47:33.832Z", "updated_at": "2016-06-17T07:47:33.832Z", "due_date": null }, "assignees": [{ "name": "Jarret O'Keefe", "username": "francisca", "id": 14, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon", "web_url": "https://gitlab.example.com/francisca" }], "assignee": { "name": "Jarret O'Keefe", "username": "francisca", "id": 14, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon", "web_url": "https://gitlab.example.com/francisca" }, "author": { "name": "Maxie Medhurst", "username": "craig_rutherford", "id": 12, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon", "web_url": "https://gitlab.example.com/craig_rutherford" }, "subscribed": true, "user_notes_count": 7, "upvotes": 0, "downvotes": 0, "merge_requests_count": 0, "due_date": null, "web_url": "http://example.com/my-group/my-project/issues/10", "references": { "short": "#10", "relative": "#10", "full": "my-group/my-project#10" }, "confidential": false, "discussion_locked": false, "task_completion_status":{ "count":0, "completed_count":0 } }, "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ci/issues/10", "body": "Vel voluptas atque dicta mollitia adipisci qui at.", "state": "pending", "created_at": "2016-07-01T11:09:13.992Z" }

注意 :不建议使用assignee列,现在我们将其显示为符合 GitLab EE API 的单一大小的数组assignees .

注意GitLab 10.6引入了 closed_by属性. 只有在 GitLab 10.6 之后关闭的问题以及关闭问题的用户帐户仍然存在时,才会显示此值.

Set a time estimate for an issue

设置此问题的估计工作时间.

  1. POST /projects/:id/issues/:issue_iid/time_estimate
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
duration string yes 以人类格式表示的持续时间. 例如:3h30m
  1. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/93/time_estimate?duration=3h30m"

响应示例:

  1. { "human_time_estimate": "3h 30m", "human_total_time_spent": null, "time_estimate": 12600, "total_time_spent": 0 }

Reset the time estimate for an issue

将此问题的估计时间重置为 0 秒.

  1. POST /projects/:id/issues/:issue_iid/reset_time_estimate
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
  1. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/93/reset_time_estimate"

响应示例:

  1. { "human_time_estimate": null, "human_total_time_spent": null, "time_estimate": 0, "total_time_spent": 0 }

Add spent time for an issue

增加了解决此问题的时间

  1. POST /projects/:id/issues/:issue_iid/add_spent_time
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
duration string yes 以人类格式表示的持续时间. 例如:3h30m
  1. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/93/add_spent_time?duration=1h"

Example response:

  1. { "human_time_estimate": null, "human_total_time_spent": "1h", "time_estimate": 0, "total_time_spent": 3600 }

Reset spent time for an issue

将此问题的总花费时间重置为 0 秒.

  1. POST /projects/:id/issues/:issue_iid/reset_spent_time
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
  1. curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/93/reset_spent_time"

响应示例:

  1. { "human_time_estimate": null, "human_total_time_spent": null, "time_estimate": 0, "total_time_spent": 0 }

Get time tracking stats

如果项目为私人项目或问题为机密,则需要提供凭据进行授权. 首选的方法是使用个人访问令牌 .

  1. GET /projects/:id/issues/:issue_iid/time_stats
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/93/time_stats"

响应示例:

  1. { "human_time_estimate": "2h", "human_total_time_spent": "1h", "time_estimate": 7200, "total_time_spent": 3600 }

List merge requests related to issue

获取与该问题相关的所有合并请求.

如果项目为私人项目或问题为机密,则需要提供凭据进行授权. 首选的方法是使用个人访问令牌 .

  1. GET /projects/:id/issues/:issue_id/related_merge_requests
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/issues/11/related_merge_requests"

响应示例:

  1. [ { "id": 29, "iid": 11, "project_id": 1, "title": "Provident eius eos blanditiis consequatur neque odit.", "description": "Ut consequatur ipsa aspernatur quisquam voluptatum fugit. Qui harum corporis quo fuga ut incidunt veritatis. Autem necessitatibus et harum occaecati nihil ea.\r\n\r\ntwitter/flight#8", "state": "opened", "created_at": "2018-09-18T14:36:15.510Z", "updated_at": "2018-09-19T07:45:13.089Z", "closed_by": null, "closed_at": null, "target_branch": "v2.x", "source_branch": "so_long_jquery", "user_notes_count": 9, "upvotes": 0, "downvotes": 0, "author": { "id": 14, "name": "Verna Hills", "username": "lawanda_reinger", "state": "active", "avatar_url": "https://www.gravatar.com/avatar/de68a91aeab1cff563795fb98a0c2cc0?s=80&d=identicon", "web_url": "https://gitlab.example.com/lawanda_reinger" }, "assignee": { "id": 19, "name": "Jody Baumbach", "username": "felipa.kuvalis", "state": "active", "avatar_url": "https://www.gravatar.com/avatar/6541fc75fc4e87e203529bd275fafd07?s=80&d=identicon", "web_url": "https://gitlab.example.com/felipa.kuvalis" }, "source_project_id": 1, "target_project_id": 1, "labels": [], "work_in_progress": false, "milestone": { "id": 27, "iid": 2, "project_id": 1, "title": "v1.0", "description": "Et tenetur voluptatem minima doloribus vero dignissimos vitae.", "state": "active", "created_at": "2018-09-18T14:35:44.353Z", "updated_at": "2018-09-18T14:35:44.353Z", "due_date": null, "start_date": null, "web_url": "https://gitlab.example.com/twitter/flight/milestones/2" }, "merge_when_pipeline_succeeds": false, "merge_status": "cannot_be_merged", "sha": "3b7b528e9353295c1c125dad281ac5b5deae5f12", "merge_commit_sha": null, "squash_commit_sha": null, "discussion_locked": null, "should_remove_source_branch": null, "force_remove_source_branch": false, "reference": "!11", "web_url": "https://gitlab.example.com/twitter/flight/merge_requests/4", "references": { "short": "!4", "relative": "!4", "full": "twitter/flight!4" }, "time_stats": { "time_estimate": 0, "total_time_spent": 0, "human_time_estimate": null, "human_total_time_spent": null }, "squash": false, "task_completion_status": { "count": 0, "completed_count": 0 }, "changes_count": "10", "latest_build_started_at": "2018-12-05T01:16:41.723Z", "latest_build_finished_at": "2018-12-05T02:35:54.046Z", "first_deployed_to_production_at": null, "pipeline": { "id": 38980952, "sha": "81c6a84c7aebd45a1ac2c654aa87f11e32338e0a", "ref": "test-branch", "status": "success", "web_url": "https://gitlab.com/gitlab-org/gitlab/pipelines/38980952" }, "head_pipeline": { "id": 38980952, "sha": "81c6a84c7aebd45a1ac2c654aa87f11e32338e0a", "ref": "test-branch", "status": "success", "web_url": "https://gitlab.example.com/twitter/flight/pipelines/38980952", "before_sha": "3c738a37eb23cf4c0ed0d45d6ddde8aad4a8da51", "tag": false, "yaml_errors": null, "user": { "id": 19, "name": "Jody Baumbach", "username": "felipa.kuvalis", "state": "active", "avatar_url": "https://www.gravatar.com/avatar/6541fc75fc4e87e203529bd275fafd07?s=80&d=identicon", "web_url": "https://gitlab.example.com/felipa.kuvalis" }, "created_at": "2018-12-05T01:16:13.342Z", "updated_at": "2018-12-05T02:35:54.086Z", "started_at": "2018-12-05T01:16:41.723Z", "finished_at": "2018-12-05T02:35:54.046Z", "committed_at": null, "duration": 4436, "coverage": "46.68", "detailed_status": { "icon": "status_warning", "text": "passed", "label": "passed with warnings", "group": "success-with-warnings", "tooltip": "passed", "has_details": true, "details_path": "/twitter/flight/pipelines/38", "illustration": null, "favicon": "https://gitlab.example.com/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png" } }, "diff_refs": { "base_sha": "d052d768f0126e8cddf80afd8b1eb07f406a3fcb", "head_sha": "81c6a84c7aebd45a1ac2c654aa87f11e32338e0a", "start_sha": "d052d768f0126e8cddf80afd8b1eb07f406a3fcb" }, "merge_error": null, "user": { "can_merge": true } } ]

List merge requests that will close issue on merge

获取所有合并请求,这些合并请求将在合并时关闭问题.

如果项目为私人项目或问题为机密,则需要提供凭据进行授权. 首选的方法是使用个人访问令牌 .

  1. GET /projects/:id/issues/:issue_iid/closed_by
Attribute Type Required Description
id integer yes 项目 ID
issue_iid integer yes 项目问题的内部 ID
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/1/issues/11/closed_by"

响应示例:

  1. [ { "id": 6471, "iid": 6432, "project_id": 1, "title": "add a test for cgi lexer options", "description": "closes #11", "state": "opened", "created_at": "2017-04-06T18:33:34.168Z", "updated_at": "2017-04-09T20:10:24.983Z", "target_branch": "master", "source_branch": "feature.custom-highlighting", "upvotes": 0, "downvotes": 0, "author": { "name": "Administrator", "username": "root", "id": 1, "state": "active", "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon", "web_url": "https://gitlab.example.com/root" }, "assignee": null, "source_project_id": 1, "target_project_id": 1, "closed_at": null, "closed_by": null, "labels": [], "work_in_progress": false, "milestone": null, "merge_when_pipeline_succeeds": false, "merge_status": "unchecked", "sha": "5a62481d563af92b8e32d735f2fa63b94e806835", "merge_commit_sha": null, "squash_commit_sha": null, "user_notes_count": 1, "should_remove_source_branch": null, "force_remove_source_branch": false, "web_url": "https://gitlab.example.com/gitlab-org/gitlab-test/merge_requests/6432", "reference": "!6432", "references": { "short": "!6432", "relative": "!6432", "full": "gitlab-org/gitlab-test!6432" }, "time_stats": { "time_estimate": 0, "total_time_spent": 0, "human_time_estimate": null, "human_total_time_spent": null } } ]

Participants on issues

如果项目为私人项目或问题为机密,则需要提供凭据进行授权. 首选的方法是使用个人访问令牌 .

  1. GET /projects/:id/issues/:issue_iid/participants
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes 项目问题的内部 ID
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/93/participants"

响应示例:

  1. [ { "id": 1, "name": "John Doe1", "username": "user1", "state": "active", "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon", "web_url": "http://localhost/user1" }, { "id": 5, "name": "John Doe5", "username": "user5", "state": "active", "avatar_url": "http://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80&d=identicon", "web_url": "http://localhost/user5" } ]

Comments on issues

注释是通过notes资源完成的.

Get user agent details

仅适用于管理员.

  1. GET /projects/:id/issues/:issue_iid/user_agent_detail
Attribute Type Required Description
id integer/string yes 经过身份验证的用户拥有的项目的 ID 或URL 编码路径
issue_iid integer yes The internal ID of a project’s issue
  1. curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/5/issues/93/user_agent_detail"

响应示例:

  1. { "user_agent": "AppleWebKit/537.36", "ip_address": "127.0.0.1", "akismet_submitted": false }