{{< details >}}

  • Tier: 基础版,专业版,旗舰版
  • Offering: JihuLab.com,私有化部署

{{< /details >}}

使用议题 API 来以编程方式读取和管理极狐GitLab 议题。议题 API:

  1. 在项目和群组间创建、更新和删除议题。
  2. 管理议题的元数据,如受托人、标签、里程碑和时间跟踪。
  3. 支持议题和合并请求之间的交叉引用。
  4. 跟踪议题在项目和史诗之间的移动和提升。
  5. 通过授权检查控制访问和可见性。

如果用户不是私有项目的成员,对该项目的 GET 请求将导致 404 状态码。

议题分页

默认情况下,GET 请求一次返回 20 个结果,因为 API 结果是分页的。阅读更多关于分页的信息。

{{< alert type=”note” >}}

references.relative 属性相对于请求的议题的群组或项目。当从其项目中获取议题时,relative 格式与 short 格式相同。当在群组或项目间请求时,预计与 full 格式相同。

{{< /alert >}}

列出议题

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

GET /issues
GET /issues?assignee_id=5
GET /issues?author_id=5
GET /issues?confidential=true
GET /issues?iids[]=42&iids[]=43
GET /issues?labels=foo
GET /issues?labels=foo,bar
GET /issues?labels=foo,bar&state=opened
GET /issues?milestone=1.0.0
GET /issues?milestone=1.0.0&state=opened
GET /issues?my_reaction_emoji=star
GET /issues?search=foo&in=title
GET /issues?state=closed
GET /issues?state=opened

支持的属性:

属性 类型 必需 描述
assignee_id integer No 返回分配给指定用户 id 的议题。与 assignee_username 互斥。 None 返回未分配的议题。 Any 返回有受托人的议题。
assignee_username string array No 返回分配给指定 username 的议题。与 assignee_id 互斥。在极狐GitLab 基础版中,assignee_username 数组只能包含一个值,否则将返回无效参数错误。
author_id integer No 返回由指定用户 id 创建的议题。与 author_username 互斥。结合 scope=allscope=assigned_to_me 使用。
author_username string No 返回由指定 username 创建的议题。与 author_id 类似并互斥。
confidential boolean No 过滤机密或公共议题。
created_after datetime No 返回在指定时间或之后创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
created_before datetime No 返回在指定时间或之前创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
due_date string No 返回没有到期日期、已过期或到期日期为本周、这个月或两周前至下个月之间的议题。接受:0(无到期日期),anytodaytomorrowoverdueweekmonthnext_month_and_previous_two_weeks
epic_id integer No 返回与给定史诗 ID 关联的议题。 None 返回未与史诗关联的议题。 Any 返回与史诗关联的议题。仅适用于专业版和旗舰版。
health_status string No 返回具有指定 health_status 的议题。在极狐GitLab 15.4 中引入。在极狐GitLab 15.5 及以后,None 返回没有健康状态分配的议题,Any 返回有健康状态分配的议题。仅限旗舰版。
iids[] integer array No 仅返回具有指定 iid 的议题。
in string No 修改 search 属性的范围。titledescription 或用逗号连接的字符串。默认是 title,description
issue_type string No 过滤到指定类型的议题。包括 issueincidenttest_casetask
iteration_id integer No 返回分配给指定迭代 ID 的议题。 None 返回不属于迭代的议题。 Any 返回属于迭代的议题。与 iteration_title 互斥。仅适用于专业版和旗舰版。
iteration_title string No 返回分配给指定标题的迭代的议题。与 iteration_id 类似并互斥。仅适用于专业版和旗舰版。
labels string No 用逗号分隔的标签名称列表,议题必须具有所有标签才能返回。None 列出所有没有标签的议题。Any 列出至少有一个标签的所有议题。No+Label(已弃用)列出所有没有标签的议题。预定义的名称不区分大小写。
milestone_id string No 返回分配给具有给定时间框值(NoneAnyUpcomingStarted)的里程碑的议题。None 列出所有没有里程碑的议题。Any 列出所有有分配里程碑的议题。Upcoming 列出所有分配给未来里程碑的议题。Started 列出所有分配给打开的、已开始的里程碑的议题。milestonemilestone_id 是互斥的。
milestone string No 里程碑标题。None 列出所有没有里程碑的议题。Any 列出所有有分配里程碑的议题。使用 NoneAny 将在未来被弃。请改用 milestone_id 属性。milestonemilestone_id 是互斥的。
my_reaction_emoji string No 返回由经过身份验证的用户通过指定的 emoji 响应的议题。None 返回未给予反应的议题。Any 返回至少给予一个反应的议题。
non_archived boolean No 仅从非存档项目中返回议题。如果为 false,响应将返回存档和非存档项目中的议题。默认值为 true
not Hash No 返回不符合所提供参数的议题。接受:assignee_idassignee_usernameauthor_idauthor_usernameiidsiteration_iditeration_titlelabelsmilestonemilestone_idweight
order_by string No 返回按 created_atdue_datelabel_prioritymilestone_duepopularitypriorityrelative_positiontitleupdated_atweight 字段排序的议题。默认是 created_at
scope string No 返回指定范围的议题:created_by_meassigned_to_meall。默认为 created_by_me
search string No 根据议题的 titledescription 搜索议题。
sort string No 返回按 ascdesc 顺序排序的议题。默认是 desc
state string No 返回 all 议题或仅返回 openedclosed 的议题。
updated_after datetime No 返回在指定时间或之后更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
updated_before datetime No 返回在指定时间或之前更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
weight integer No 返回具有指定 weight 的议题。None 返回没有权重分配的议题。Any 返回有权重分配的议题。仅适用于专业版和旗舰版。
with_labels_details boolean No 如果为 true,响应将返回标签字段中每个标签的更多详细信息::name:color:description:description_html:text_color。默认是 false

示例请求:

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

示例响应:

[
   {
      "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" : "管理员",
         "web_url" : "https://gitlab.example.com/root",
         "avatar_url" : null,
         "username" : "root"
      }],
      "assignee" : {
         "state" : "active",
         "id" : 1,
         "name" : "管理员",
         "web_url" : "https://gitlab.example.com/root",
         "avatar_url" : null,
         "username" : "root"
      },
      "type" : "ISSUE",
      "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",
      "imported":false,
      "imported_from": "none",
      "web_url": "http://gitlab.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,
      "issue_type": "issue",
      "severity": "UNKNOWN",
      "_links":{
         "self":"http://gitlab.example.com/api/v4/projects/1/issues/76",
         "notes":"http://gitlab.example.com/api/v4/projects/1/issues/76/notes",
         "award_emoji":"http://gitlab.example.com/api/v4/projects/1/issues/76/award_emoji",
         "project":"http://gitlab.example.com/api/v4/projects/1",
         "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75"
      },
      "task_completion_status":{
         "count":0,
         "completed_count":0
      }
   }
]

在极狐GitLab 专业版或旗舰版上创建的议题包括 weight 属性:

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

在极狐GitLab 专业版或旗舰版上创建的议题包括 epic 属性:

{
   "project_id" : 4,
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute
   "epic": {
     "id" : 42,
     "iid" : 5,
     "title": "My epic epic",
     "url" : "/groups/h5bp/-/epics/5",
     "group_id": 8
   },
   ...
}

在极狐GitLab 旗舰版上创建的议题包括 health_status 属性:

[
   {
      "state" : "opened",
      "description" : "Ratione dolores corrupti mollitia soluta quia.",
      "health_status": "on_track",
      ...
   }
]

{{< alert type=”warning” >}}

assignee 列已弃用。

{{< /alert >}}

{{< alert type=”warning” >}}

epic_iid 属性已弃用,并在 API 版本 5 中计划移除。请改用 epic 属性的 iid

{{< /alert >}}

列出群组议题

获取群组的议题列表。

如果群组是私有的,您必须提供凭据进行授权。首选方式是使用个人访问令牌

GET /groups/:id/issues
GET /groups/:id/issues?assignee_id=5
GET /groups/:id/issues?author_id=5
GET /groups/:id/issues?confidential=true
GET /groups/:id/issues?iids[]=42&iids[]=43
GET /groups/:id/issues?labels=foo
GET /groups/:id/issues?labels=foo,bar
GET /groups/:id/issues?labels=foo,bar&state=opened
GET /groups/:id/issues?milestone=1.0.0
GET /groups/:id/issues?milestone=1.0.0&state=opened
GET /groups/:id/issues?my_reaction_emoji=star
GET /groups/:id/issues?search=issue+title+or+description
GET /groups/:id/issues?state=closed
GET /groups/:id/issues?state=opened

支持的属性:

属性 类型 必需 描述
id integer/string Yes 群组的全局 ID 或URL 编码路径
assignee_id integer No 返回分配给指定用户 id 的议题。与 assignee_username 互斥。 None 返回未分配的议题。 Any 返回有受托人的议题。
assignee_username string array No 返回分配给指定 username 的议题。与 assignee_id 类似并互斥。在极狐GitLab 基础版中,assignee_username 数组只能包含一个值,否则将返回无效参数错误。
author_id integer No 返回由指定用户 id 创建的议题。与 author_username 互斥。结合 scope=allscope=assigned_to_me 使用。
author_username string No 返回由指定 username 创建的议题。与 author_id 类似并互斥。
confidential boolean No 过滤机密或公共议题。
created_after datetime No 返回在指定时间或之后创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
created_before datetime No 返回在指定时间或之前创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
due_date string No 返回没有到期日期、已过期或到期日期为本周、这个月或两周前至下个月之间的议题。接受:0(无到期日期),anytodaytomorrowoverdueweekmonthnext_month_and_previous_two_weeks
epic_id integer No 返回与给定史诗 ID 关联的议题。 None 返回未与史诗关联的议题。 Any 返回与史诗关联的议题。仅适用于专业版和旗舰版。
iids[] integer array No 仅返回具有指定 iid 的议题。
issue_type string No 过滤到指定类型的议题。包括 issueincidenttest_casetask
iteration_id integer No 返回分配给指定迭代 ID 的议题。 None 返回不属于迭代的议题。 Any 返回属于迭代的议题。与 iteration_title 互斥。仅适用于专业版和旗舰版。
iteration_title string No 返回分配给指定标题的迭代的议题。与 iteration_id 类似并互斥。仅适用于专业版和旗舰版。
labels string No 用逗号分隔的标签名称列表,议题必须具有所有标签才能返回。None 列出所有没有标签的议题。Any 列出至少有一个标签的所有议题。No+Label(已弃用)列出所有没有标签的议题。预定义的名称不区分大小写。
milestone string No 里程碑标题。None 列出所有没有里程碑的议题。Any 列出所有有分配里程碑的议题。
my_reaction_emoji string No 返回由经过身份验证的用户通过指定的 emoji 响应的议题。None 返回未给予反应的议题。Any 返回至少给予一个反应的议题。
non_archived boolean No 仅从非存档项目中返回议题。默认值为 true。
not Hash No 返回不符合所提供参数的议题。接受:labelsmilestoneauthor_idauthor_usernameassignee_idassignee_usernamemy_reaction_emojisearchin
order_by string No 返回按 created_atupdated_atprioritydue_daterelative_positionlabel_prioritymilestone_duepopularityweight 字段排序的议题。默认是 created_at
scope string No 返回指定范围的议题:created_by_meassigned_to_meall。默认为 all
search string No 根据群组议题的 titledescription 搜索议题。
sort string No 返回按 ascdesc 顺序排序的议题。默认是 desc
state string No 返回所有议题或仅返回 openedclosed 的议题。
updated_after datetime No 返回在指定时间或之后更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
updated_before datetime No 返回在指定时间或之前更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
weight integer No 返回具有指定 weight 的议题。None 返回没有权重分配的议题。Any 返回有权重分配的议题。仅适用于专业版和旗舰版。
with_labels_details boolean No 如果为 true,响应将返回标签字段中每个标签的更多详细信息::name:color:description:description_html:text_color。默认是 false

示例请求:

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

示例响应:

[
   {
      "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" : "管理员"
      },
      "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"
      },
      "type" : "ISSUE",
      "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,
      "imported": false,
      "imported_from": "none",
      "web_url": "http://gitlab.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,
      "issue_type": "issue",
      "severity": "UNKNOWN",
      "_links":{
         "self":"http://gitlab.example.com/api/v4/projects/4/issues/41",
         "notes":"http://gitlab.example.com/api/v4/projects/4/issues/41/notes",
         "award_emoji":"http://gitlab.example.com/api/v4/projects/4/issues/41/award_emoji",
         "project":"http://gitlab.example.com/api/v4/projects/4",
         "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75"
      },
      "task_completion_status":{
         "count":0,
         "completed_count":0
      }
   }
]

在极狐GitLab 专业版或旗舰版上创建的议题包括 weight 属性:

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

在极狐GitLab 专业版或旗舰版上创建的议题包括 epic 属性:

{
   "project_id" : 4,
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute
   "epic": {
     "id" : 42,
     "iid" : 5,
     "title": "My epic epic",
     "url" : "/groups/h5bp/-/epics/5",
     "group_id": 8
   },
   ...
}

在极狐GitLab 旗舰版上创建的议题包括 health_status 属性:

[
   {
      "project_id" : 4,
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "health_status": "at_risk",
      ...
   }
]

{{< alert type=”warning” >}}

assignee 列已弃用。我们现在显示为单大小数组 assignees 以符合极狐GitLab EE API。

{{< /alert >}}

{{< alert type=”warning” >}}

epic_iid 属性已弃用,并在 API 版本 5 中计划移除。请改用 epic 属性的 iid

{{< /alert >}}

列出项目议题

获取项目的议题列表。

如果项目是私有的,您需要提供凭据进行授权。首选方式是使用个人访问令牌

GET /projects/:id/issues
GET /projects/:id/issues?assignee_id=5
GET /projects/:id/issues?author_id=5
GET /projects/:id/issues?confidential=true
GET /projects/:id/issues?iids[]=42&iids[]=43
GET /projects/:id/issues?labels=foo
GET /projects/:id/issues?labels=foo,bar
GET /projects/:id/issues?labels=foo,bar&state=opened
GET /projects/:id/issues?milestone=1.0.0
GET /projects/:id/issues?milestone=1.0.0&state=opened
GET /projects/:id/issues?my_reaction_emoji=star
GET /projects/:id/issues?search=issue+title+or+description
GET /projects/:id/issues?state=closed
GET /projects/:id/issues?state=opened

支持的属性:

属性 类型 必需 描述
id integer/string Yes 项目的全局 ID 或URL 编码路径
assignee_id integer No 返回分配给指定用户 id 的议题。与 assignee_username 互斥。 None 返回未分配的议题。 Any 返回有受托人的议题。
assignee_username string array No 返回分配给指定 username 的议题。与 assignee_id 类似并互斥。在极狐GitLab 基础版中,assignee_username 数组只能包含一个值,否则将返回无效参数错误。
author_id integer No 返回由指定用户 id 创建的议题。与 author_username 互斥。结合 scope=allscope=assigned_to_me 使用。
author_username string No 返回由指定 username 创建的议题。与 author_id 类似并互斥。
confidential boolean No 过滤机密或公共议题。
created_after datetime No 返回在指定时间或之后创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
created_before datetime No 返回在指定时间或之前创建的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
due_date string No 返回没有到期日期、已过期或到期日期为本周、这个月或两周前至下个月之间的议题。接受:0(无到期日期),anytodaytomorrowoverdueweekmonthnext_month_and_previous_two_weeks
epic_id integer No 返回与给定史诗 ID 关联的议题。 None 返回未与史诗关联的议题。 Any 返回与史诗关联的议题。仅适用于专业版和旗舰版。
iids[] integer array No 仅返回具有指定 iid 的议题。
issue_type string No 过滤到指定类型的议题。包括 issueincidenttest_casetask
iteration_id integer No 返回分配给指定迭代 ID 的议题。 None 返回不属于迭代的议题。 Any 返回属于迭代的议题。与 iteration_title 互斥。仅适用于专业版和旗舰版。
iteration_title string No 返回分配给指定标题的迭代的议题。与 iteration_id 类似并互斥。仅适用于专业版和旗舰版。
labels string No 用逗号分隔的标签名称列表,议题必须具有所有标签才能返回。None 列出所有没有标签的议题。Any 列出至少有一个标签的所有议题。No+Label(已弃用)列出所有没有标签的议题。预定义的名称不区分大小写。
milestone string No 里程碑标题。None 列出所有没有里程碑的议题。Any 列出所有有分配里程碑的议题。
my_reaction_emoji string No 返回由经过身份验证的用户通过指定的 emoji 响应的议题。None 返回未给予反应的议题。Any 返回至少给予一个反应的议题。
not Hash No 返回不符合所提供参数的议题。接受:labelsmilestoneauthor_idauthor_usernameassignee_idassignee_usernamemy_reaction_emojisearchin
order_by string No 返回按 created_atupdated_atprioritydue_daterelative_positionlabel_prioritymilestone_duepopularityweight 字段排序的议题。默认是 created_at
scope string No 返回指定范围的议题:created_by_meassigned_to_meall。默认为 all
search string No 根据项目议题的 titledescription 搜索议题。
sort string No 返回按 ascdesc 顺序排序的议题。默认是 desc
state string No 返回所有议题或仅返回 openedclosed 的议题。
updated_after datetime No 返回在指定时间或之后更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
updated_before datetime No 返回在指定时间或之前更新的议题。预计为 ISO 8601 格式 (2019-03-15T08:00:00Z)。
weight integer No 返回具有指定 weight 的议题。None 返回没有权重分配的议题。Any 返回有权重分配的议题。仅适用于专业版和旗舰版。
with_labels_details boolean No 如果为 true,响应将返回标签字段中每个标签的更多详细信息::name:color:description:description_html:text_color。默认是 false

示例请求:

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

示例响应:

[
   {
      "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" : "管理员"
      },
      "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"
      },
      "type" : "ISSUE",
      "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" : "管理员"
      },
      "user_notes_count": 1,
      "due_date": "2016-07-22",
      "imported": false,
      "imported_from": "none",
      "web_url": "http://gitlab.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,
      "issue_type": "issue",
      "severity": "UNKNOWN",
      "_links":{
         "self":"http://gitlab.example.com/api/v4/projects/4/issues/41",
         "notes":"http://gitlab.example.com/api/v4/projects/4/issues/41/notes",
         "award_emoji":"http://gitlab.example.com/api/v4/projects/4/issues/41/award_emoji",
         "project":"http://gitlab.example.com/api/v4/projects/4",
         "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75"
      },
      "task_completion_status":{
         "count":0,
         "completed_count":0
      }
   }
]

在极狐GitLab 专业版或旗舰版上创建的议题包括 weight 属性:

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

在极狐GitLab 专业版或旗舰版上创建的议题包括 epic 属性:

{
   "project_id" : 4,
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute
   "epic": {
     "id" : 42,
     "iid" : 5,
     "title": "My epic epic",
     "url" : "/groups/h5bp/-/epics/5",
     "group_id": 8
   },
   ...
}

在极狐GitLab 旗舰版上创建的议题包括 health_status 属性:

[
   {
      "project_id" : 4,
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "health_status": "at_risk",
      ...
   }
]

{{< alert type=”warning” >}}

assignee 列已弃用。我们现在显示为单大小数组 assignees 以符合极狐GitLab EE API。

{{< /alert >}}

{{< alert type=”warning” >}}

epic_iid 属性已弃用,并在 API 版本 5 中计划移除。请改用 epic 属性的 iid

{{< /alert >}}

单个议题

仅适用于管理员。

获取单个议题。

首选方式是使用个人访问令牌

GET /issues/:id

支持的属性:

属性 类型 必需 描述
id integer Yes 议题的 ID。

示例请求:

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

示例响应:

{
  "id": 1,
  "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"
  },
  "type": "ISSUE",
  "labels": [],
  "upvotes": 4,
  "downvotes": 0,
  "merge_requests_count": 0,
  "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,
  "imported": false,
  "imported_from": "none",
  "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,
  "issue_type": "issue",
  "severity": "UNKNOWN",
  "task_completion_status": {
    "count": 0,
    "completed_count": 0
  },
  "weight": null,
  "has_tasks": false,
  "_links": {
    "self": "http://gitlab.example:3000/api/v4/projects/1/issues/1",
    "notes": "http://gitlab.example:3000/api/v4/projects/1/issues/1/notes",
    "award_emoji": "http://gitlab.example:3000/api/v4/projects/1/issues/1/award_emoji",
    "project": "http://gitlab.example:3000/api/v4/projects/1",
    "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75"
  },
  "moved_to_id": null,
  "service_desk_reply_to": "service.desk@gitlab.com"
}

在极狐GitLab 专业版或旗舰版上由用户创建的议题包含 weight 属性:

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

在极狐GitLab 专业版或旗舰版上由用户创建的议题包含 epic 属性:

{
   "project_id" : 4,
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "epic": {
   "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute
   "epic": {
     "id" : 42,
     "iid" : 5,
     "title": "My epic epic",
     "url" : "/groups/h5bp/-/epics/5",
     "group_id": 8
   },
   ...
}

极狐GitLab 旗舰版用户还可以查看 health_status 属性:

[
   {
      "project_id" : 4,
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "health_status": "on_track",
      ...
   }
]

{{< alert type=”warning” >}}

assignee 列已被弃用。为符合极狐GitLab企业版 API规范,现将其统一显示为单维数组 assignees

{{< /alert >}}

{{< alert type=”warning” >}}

epic_iid 属性被弃用,而且计划在 API v5 中被移除。使用 epiciid 取而代之。

{{< /alert >}}

单个项目议题

获取单个项目议题。

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

GET /projects/:id/issues/:issue_iid

支持的属性:

属性 类型 必需 描述
id integer/string Yes 项目的全局 ID 或 URL 编码路径
issue_iid integer Yes 项目议题的内部 ID。

示例请求:

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

示例响应:

{
   "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"
   },
   "type" : "ISSUE",
   "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,
   "imported": false,
   "imported_from": "none",
   "web_url": "http://gitlab.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,
   "issue_type": "issue",
   "severity": "UNKNOWN",
   "_links": {
      "self": "http://gitlab.example.com/api/v4/projects/1/issues/2",
      "notes": "http://gitlab.example.com/api/v4/projects/1/issues/2/notes",
      "award_emoji": "http://gitlab.example.com/api/v4/projects/1/issues/2/award_emoji",
      "project": "http://gitlab.example.com/api/v4/projects/1",
      "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75"
   },
   "task_completion_status":{
      "count":0,
      "completed_count":0
   }
}

在极狐GitLab 专业版或旗舰版上由用户创建的议题包含 weight 属性:

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

在极狐GitLab 专业版或旗舰版上由用户创建的议题包含 epic 属性:

{
   "project_id" : 4,
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute
   "epic": {
     "id" : 42,
     "iid" : 5,
     "title": "My epic epic",
     "url" : "/groups/h5bp/-/epics/5",
     "group_id": 8
   },
   ...
}

极狐GitLab 旗舰版用户还可以看到 health_status 属性:

[
   {
      "project_id" : 4,
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "health_status": "on_track",
      ...
   }
]

{{< alert type=”warning” >}}

assignee 列已被弃用。为符合极狐GitLab企业版 API规范,现将其统一显示为单维数组 assignees

{{< /alert >}}

{{< alert type=”warning” >}}

epic_iid 属性已被弃用而且计划在 API v5 中移除。使用 epic 属性的 iid 取而代之。

{{< /alert >}}

新议题

创建一个新项目议题。

POST /projects/:id/issues

支持的属性:

属性 类型 必需 描述
id integer/string Yes 项目的全局 ID 或 URL 编码路径
assignee_id integer No 要分配议题给的用户 ID。仅在极狐GitLab 基础版中出现。
assignee_ids integer array No 要分配议题给的用户 ID。仅限专业版和旗舰版。
confidential boolean No 设置议题为机密。默认值为 false
created_at string No 议题创建时间。日期时间字符串,ISO 8601 格式,例如 2016-03-11T03:45:40Z。需要管理员或项目/群组拥有者权限。
description string No 议题描述。限制为 1,048,576 个字符。
discussion_to_resolve string No 要解决的讨论 ID。这会使用默认描述填充议题,并将讨论标记为已解决。与 merge_request_to_resolve_discussions_of 结合使用。
due_date string No 到期日期。日期时间字符串,格式为 YYYY-MM-DD,例如 2016-03-11
epic_id integer No 要添加议题到的史诗 ID。有效值大于或等于 0。仅限专业版和旗舰版。
epic_iid integer No 要添加议题到的史诗 IID。有效值大于或等于 0。(已弃用,计划在 API 版本 5 中删除)。仅限专业版和旗舰版。
iid integer/string No 项目议题的内部 ID(需要管理员或项目拥有者权限)。
issue_type string No 议题类型。可以是 issueincidenttest_casetask。默认值为 issue
labels string No 逗号分隔的标签名称分配给新议题。如果标签尚不存在,则会创建新的项目标签并分配给议题。
merge_request_to_resolve_discussions_of integer No 要解决所有议题的合并请求 IID。这会使用默认描述填充议题,并将所有讨论标记为已解决。传递描述或标题时,这些值优先于默认值。
milestone_id integer No 要分配议题的里程碑的全局 ID。要找到与里程碑关联的 milestone_id,请查看分配了里程碑的议题并使用 API 检索议题详细信息。
title string Yes 议题标题。
weight integer No 议题的权重。有效值大于或等于 0。仅限专业版和旗舰版。

示例请求:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/4/issues?title=Issues%20with%20auth&labels=bug"

示例响应:

{
   "project_id" : 4,
   "id" : 84,
   "created_at" : "2016-01-07T12:44:33.959Z",
   "iid" : 14,
   "title" : "Issues with auth",
   "state" : "opened",
   "assignees" : [],
   "assignee" : null,
   "type" : "ISSUE",
   "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://gitlab.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,
   "issue_type": "issue",
   "severity": "UNKNOWN",
   "_links": {
      "self": "http://gitlab.example.com/api/v4/projects/1/issues/2",
      "notes": "http://gitlab.example.com/api/v4/projects/1/issues/2/notes",
      "award_emoji": "http://gitlab.example.com/api/v4/projects/1/issues/2/award_emoji",
      "project": "http://gitlab.example.com/api/v4/projects/1",
      "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75"
   },
   "task_completion_status":{
      "count":0,
      "completed_count":0
   }
}

在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 weight 属性:

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

在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 epic 属性:

{
   "project_id" : 4,
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute
   "epic": {
     "id" : 42,
     "iid" : 5,
     "title": "My epic epic",
     "url" : "/groups/h5bp/-/epics/5",
     "group_id": 8
   },
   ...
}

在极狐GitLab 旗舰版上用户创建的议题会包含 health_status 属性:

[
   {
      "project_id" : 4,
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "health_status": "on_track",
      ...
   }
]

{{< alert type=”warning” >}}

assignee 列已被弃用。为符合极狐GitLab企业版 API规范,现将其统一显示为单维数组 assignees

{{< /alert >}}

{{< alert type=”warning” >}}

epic_iid 属性已被弃用而且计划在 API v5 中移除。使用 epic 属性的 iid 取而代之。

{{< /alert >}}

速率限制

为帮助避免滥用,用户可以被限制为每分钟特定数量的 Create 请求。请参阅议题速率限制

编辑议题

更新现有项目议题。此请求也用于关闭或重新打开议题(使用 state_event)。

请求成功至少需要以下参数之一:

  • :assignee_id
  • :assignee_ids
  • :confidential
  • :created_at
  • :description
  • :discussion_locked
  • :due_date
  • :issue_type
  • :labels
  • :milestone_id
  • :state_event
  • :title
PUT /projects/:id/issues/:issue_iid

支持的属性:

属性 类型 必需 描述
id integer/string Yes 项目的全局 ID 或 URL 编码路径
issue_iid integer Yes 项目议题的内部 ID。
add_labels string No 逗号分隔的标签名称添加到议题。如果标签尚不存在,则会创建新的项目标签并分配给议题。
assignee_ids integer array No 要分配议题给的用户 ID。设置为 0 或提供空值以取消分配所有受让人。
confidential boolean No 更新议题为机密。
description string No 议题描述。限制为 1,048,576 个字符。
discussion_locked boolean No Flag indicating if the issue’s discussion is locked. If the discussion is locked only project members can add or edit comments.
due_date string No 到期日期。日期时间字符串,格式为 YYYY-MM-DD,例如 2016-03-11
epic_id integer No 要将议题添加到的史诗的 ID。有效值大于或等于 0。仅限专业版和旗舰版。
epic_iid integer No 要将议题添加到的史诗的 IID。有效值大于或等于 0。(已弃用,计划在 API 版本 5 中移除)。仅限专业版和旗舰版。
issue_type string No 更新议题的类型。可以是 issueincidenttest_casetask 之一。
labels string No 议题的逗号分隔标签名称。设置为空字符串以取消分配所有标签。如果标签不存在,则创建新的项目标签并将其分配给议题。
milestone_id integer No 要分配议题的里程碑的全局 ID。设置为 0 或提供空值以取消分配里程碑。
remove_labels string No 逗号分隔的标签名称从议题中删除。
state_event string No 议题的状态事件。要关闭议题,请使用 close,要重新打开,请使用 reopen
title string No 议题标题。
updated_at string No 议题更新时间。日期时间字符串,ISO 8601 格式,例如 2016-03-11T03:45:40Z(需要管理员或项目拥有者权限)。空字符串或空值不被接受。
weight integer No 议题的权重。有效值大于或等于 0。仅限专业版和旗舰版。

示例请求:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/4/issues/85?state_event=close"

示例响应:

{
   "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://gitlab.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,
   "issue_type": "issue",
   "severity": "UNKNOWN",
   "_links": {
      "self": "http://gitlab.example.com/api/v4/projects/1/issues/2",
      "notes": "http://gitlab.example.com/api/v4/projects/1/issues/2/notes",
      "award_emoji": "http://gitlab.example.com/api/v4/projects/1/issues/2/award_emoji",
      "project": "http://gitlab.example.com/api/v4/projects/1",
      "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75"

   },
   "task_completion_status":{
      "count":0,
      "completed_count":0
   }
}

在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 weight 属性:

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

在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 epic 属性:

{
   "project_id" : 4,
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute
   "epic": {
     "id" : 42,
     "iid" : 5,
     "title": "My epic epic",
     "url" : "/groups/h5bp/-/epics/5",
     "group_id": 8
   },
   ...
}

在极狐GitLab 旗舰版上用户创建的议题会包含 health_status 属性:

[
   {
      "project_id" : 4,
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "health_status": "on_track",
      ...
   }
]

{{< alert type=”warning” >}}

epic_iid 属性已被弃用而且计划在 API v5 中被移除。使用 epiciid 属性取而代之。

{{< /alert >}}

{{< alert type=”warning” >}}

assignee 列已被弃用。为符合极狐GitLab企业版 API规范,现将其统一显示为单维数组 assignees

{{< /alert >}}

删除议题

仅限管理员和项目所有者。

删除议题。

DELETE /projects/:id/issues/:issue_iid

支持的属性:

属性 类型 必需 描述
id integer/string Yes 项目的全局 ID 或 URL 编码路径
issue_iid integer Yes 项目议题的内部 ID。

示例请求:

curl --request DELETE \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/4/issues/85"

如果成功,返回 204 No Content

重新排序议题

重新排序议题。您可以在手动排序议题时看到结果。

PUT /projects/:id/issues/:issue_iid/reorder

支持的属性:

属性 类型 必需 描述
id integer/string Yes 项目的全局 ID 或 URL 编码路径
issue_iid integer Yes 项目议题的内部 ID。
move_after_id integer No 项目议题的全局 ID,应放在此议题之后。
move_before_id integer No 项目议题的全局 ID,应放在此议题之前。

示例请求:

curl --request PUT \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/4/issues/85/reorder?move_after_id=51&move_before_id=92"

移动议题

将议题移动到不同项目。如果目标项目是源项目或用户权限不足,则返回状态码 400 的错误消息。

如果目标项目中存在具有相同名称的标签或里程碑,则将其分配给正在移动的议题。

POST /projects/:id/issues/:issue_iid/move

支持的属性:

属性 类型 必需 描述
id integer/string Yes 项目的全局 ID 或 URL 编码路径
issue_iid integer Yes 项目议题的内部 ID。
to_project_id integer Yes 新项目的 ID。

示例请求:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --form to_project_id=5 \
  --url "https://gitlab.example.com/api/v4/projects/4/issues/85/move"

示例响应:

{
  "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"
  },
  "type" : "ISSUE",
  "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,
  "imported": false,
  "imported_from": "none",
  "web_url": "http://gitlab.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,
  "issue_type": "issue",
  "severity": "UNKNOWN",
  "_links": {
    "self": "http://gitlab.example.com/api/v4/projects/1/issues/2",
    "notes": "http://gitlab.example.com/api/v4/projects/1/issues/2/notes",
    "award_emoji": "http://gitlab.example.com/api/v4/projects/1/issues/2/award_emoji",
    "project": "http://gitlab.example.com/api/v4/projects/1",
    "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75"
  },
  "task_completion_status":{
     "count":0,
     "completed_count":0
  }
}

在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 weight 属性:

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

在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 epic 属性:

{
   "project_id" : 4,
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute
   "epic": {
     "id" : 42,
     "iid" : 5,
     "title": "My epic epic",
     "url" : "/groups/h5bp/-/epics/5",
     "group_id": 8
   },
   ...
}

在极狐GitLab 旗舰版上用户创建的议题会包含 health_status 属性:

[
   {
      "project_id" : 4,
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "health_status": "on_track",
      ...
   }
]

{{< alert type=”warning” >}}

assignee 列已被弃用。为符合极狐GitLab企业版 API规范,现将其统一显示为单维数组 assignees

{{< /alert >}}

{{< alert type=”warning” >}}

epic_iid 属性已被弃用而且计划在 API v5 中被移除。使用 epic 属性的 iid 取而代之。

{{< /alert >}}

克隆议题

将议题克隆到指定项目。尽可能复制数据,只要目标项目包含等效标准,例如标签或里程碑。

如果权限不足,则返回状态码 400 的错误消息。

POST /projects/:id/issues/:issue_iid/clone

支持的属性:

属性 类型 必需 描述
id integer/string Yes 项目的 ID 或 URL 编码路径
issue_iid integer Yes 项目议题的内部 ID。
to_project_id integer Yes 新项目的 ID。
with_notes boolean No 克隆议题时带有注释。默认值为 false

示例请求:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/1/clone?with_notes=true&to_project_id=6"

示例响应:

{
  "id":290,
  "iid":1,
  "project_id":143,
  "title":"foo",
  "description":"closed",
  "state":"opened",
  "created_at":"2021-09-14T22:24:11.696Z",
  "updated_at":"2021-09-14T22:24:11.696Z",
  "closed_at":null,
  "closed_by":null,
  "labels":[

  ],
  "milestone":null,
  "assignees":[
    {
      "id":179,
      "name":"John Doe2",
      "username":"john",
      "state":"active",
      "avatar_url":"https://www.gravatar.com/avatar/10fc7f102be8de7657fb4d80898bbfe3?s=80\u0026d=identicon",
      "web_url":"https://gitlab.example.com/john"
    }
  ],
  "author":{
    "id":179,
    "name":"John Doe2",
    "username":"john",
    "state":"active",
    "avatar_url":"https://www.gravatar.com/avatar/10fc7f102be8de7657fb4d80898bbfe3?s=80\u0026d=identicon",
    "web_url":"https://gitlab.example.com/john"
  },
  "type":"ISSUE",
  "assignee":{
    "id":179,
    "name":"John Doe2",
    "username":"john",
    "state":"active",
    "avatar_url":"https://www.gravatar.com/avatar/10fc7f102be8de7657fb4d80898bbfe3?s=80\u0026d=identicon",
    "web_url":"https://gitlab.example.com/john"
  },
  "user_notes_count":1,
  "merge_requests_count":0,
  "upvotes":0,
  "downvotes":0,
  "due_date":null,
  "imported":false,
  "imported_from": "none",
  "confidential":false,
  "discussion_locked":null,
  "issue_type":"issue",
  "severity": "UNKNOWN",
  "web_url":"https://gitlab.example.com/namespace1/project2/-/issues/1",
  "time_stats":{
    "time_estimate":0,
    "total_time_spent":0,
    "human_time_estimate":null,
    "human_total_time_spent":null
  },
  "task_completion_status":{
    "count":0,
    "completed_count":0
  },
  "blocking_issues_count":0,
  "has_tasks":false,
  "_links":{
    "self":"https://gitlab.example.com/api/v4/projects/143/issues/1",
    "notes":"https://gitlab.example.com/api/v4/projects/143/issues/1/notes",
    "award_emoji":"https://gitlab.example.com/api/v4/projects/143/issues/1/award_emoji",
    "project":"https://gitlab.example.com/api/v4/projects/143",
    "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75"
  },
  "references":{
    "short":"#1",
    "relative":"#1",
    "full":"namespace1/project2#1"
  },
  "subscribed":true,
  "moved_to_id":null,
  "service_desk_reply_to":null
}

通知

以下请求与议题的电子邮件通知相关。

订阅议题

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

POST /projects/:id/issues/:issue_iid/subscribe

支持的属性:

属性 类型 必需 描述
id integer/string Yes 项目的全局 ID 或 URL 编码路径
issue_iid integer Yes 项目议题的内部 ID。

示例请求:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/subscribe"

示例响应:

{
  "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"
  },
  "type" : "ISSUE",
  "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://gitlab.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,
  "issue_type": "issue",
  "severity": "UNKNOWN",
  "_links": {
    "self": "http://gitlab.example.com/api/v4/projects/1/issues/2",
    "notes": "http://gitlab.example.com/api/v4/projects/1/issues/2/notes",
    "award_emoji": "http://gitlab.example.com/api/v4/projects/1/issues/2/award_emoji",
    "project": "http://gitlab.example.com/api/v4/projects/1",
    "closed_as_duplicate_of": "http://gitlab.example.com/api/v4/projects/1/issues/75"
  },
  "task_completion_status":{
     "count":0,
     "completed_count":0
  }
}

在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 weight 属性:

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

在极狐GitLab 专业版或旗舰版上用户创建的议题会包含 epic 属性:

{
   "project_id" : 4,
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "epic_iid" : 5, //deprecated, use `iid` of the `epic` attribute
   "epic": {
     "id" : 42,
     "iid" : 5,
     "title": "My epic epic",
     "url" : "/groups/h5bp/-/epics/5",
     "group_id": 8
   },
   ...
}

在极狐GitLab 旗舰版上用户创建的议题会包含 health_status 属性:

[
   {
      "project_id" : 4,
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "health_status": "on_track",
      ...
   }
]

{{< alert type=”warning” >}}

assignee 列已被弃用。为符合极狐GitLab企业版 API规范,现将其统一显示为单维数组 assignees

{{< /alert >}}

{{< alert type=”warning” >}}

epic_iid 属性已弃用而且计划在 API v5 中被移除。使用 epiciid 属性取而代之。

{{< /alert >}}

取消订阅议题

取消认证用户对该议题的订阅,以不接收来自它的通知。如果用户未订阅该议题,则返回状态码 304

POST /projects/:id/issues/:issue_iid/unsubscribe

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/unsubscribe"

响应示例:

{
  "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"
  },
  "type" : "ISSUE",
  "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://gitlab.example.com/my-group/my-project/issues/12",
  "references": {
    "short": "#12",
    "relative": "#12",
    "full": "my-group/my-project#12"
  },
  "confidential": false,
  "discussion_locked": false,
  "issue_type": "issue",
  "severity": "UNKNOWN",
  "task_completion_status":{
     "count":0,
     "completed_count":0
  }
}

创建待办事项

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

POST /projects/:id/issues/:issue_iid/todo

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/todo"

响应示例:

{
  "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": "管理员",
    "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"
    },
    "type" : "ISSUE",
    "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://gitlab.example.com/my-group/my-project/issues/10",
    "references": {
      "short": "#10",
      "relative": "#10",
      "full": "my-group/my-project#10"
    },
    "confidential": false,
    "discussion_locked": false,
    "issue_type": "issue",
    "severity": "UNKNOWN",
    "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"
}

{{< alert type=”warning” >}}

assignee 列已被弃用。为符合极狐GitLab企业版 API规范,现将其统一显示为单维数组 assignees

{{< /alert >}}

将议题提升为史诗

{{< details >}}

  1. Tier: 专业版, 旗舰版
  2. Offering: JihuLab.com, 私有化部署

{{< /details >}}

通过添加带有 /promote 的评论,将议题提升为史诗 快速操作

有关将议题提升为史诗的更多信息,请参阅 将议题提升为史诗

POST /projects/:id/issues/:issue_iid/notes

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。
body String 注释的内容。必须在新行的开头包含 /promote。如果注释仅包含 /promote,则提升议题,但不添加评论。否则,其他行形成评论。

请求示例:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/11/notes?body=Lets%20promote%20this%20to%20an%20epic%0A%0A%2Fpromote"

响应示例:

{
   "id":699,
   "type":null,
   "body":"Lets promote this to an epic",
   "attachment":null,
   "author": {
      "id":1,
      "name":"Alexandra Bashirian",
      "username":"eileen.lowe",
      "state":"active",
      "avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url":"https://gitlab.example.com/eileen.lowe"
   },
   "created_at":"2020-12-03T12:27:17.844Z",
   "updated_at":"2020-12-03T12:27:17.844Z",
   "system":false,
   "noteable_id":461,
   "noteable_type":"Issue",
   "resolvable":false,
   "confidential":false,
   "noteable_iid":33,
   "commands_changes": {
      "promote_to_epic":true
   }
}

时间跟踪

以下请求与议题的 时间跟踪 相关。

为议题设置时间估算

为此议题设置预估工作时间。

POST /projects/:id/issues/:issue_iid/time_estimate

支持的属性:

属性 类型 必需 描述
duration string 人类可读格式的持续时间。例如:3h30m
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/time_estimate?duration=3h30m"

响应示例:

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

重置议题的时间估算

将此议题的预估时间重置为 0 秒。

POST /projects/:id/issues/:issue_iid/reset_time_estimate

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/reset_time_estimate"

响应示例:

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

为议题添加已用时间

为此议题添加已用时间。

POST /projects/:id/issues/:issue_iid/add_spent_time

支持的属性:

属性 类型 必需 描述
duration string 人类可读格式的持续时间。例如:3h30m
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。
summary string 时间如何花费的摘要。

请求示例:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/add_spent_time?duration=1h"

响应示例:

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

重置议题的已用时间

将此议题的总已用时间重置为 0 秒。

POST /projects/:id/issues/:issue_iid/reset_spent_time

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

curl --request POST \
  --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/reset_spent_time"

响应示例:

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

获取时间跟踪统计

以人类可读的格式(例如,1h30m)和秒数获取议题的时间跟踪统计。

如果项目是私有的或议题是机密的,您必须提供凭据进行授权。推荐的方式是使用 个人访问令牌

GET /projects/:id/issues/:issue_iid/time_stats

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/time_stats"

响应示例:

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

合并请求

以下请求与议题和合并请求之间的关系有关。

列出与议题相关的合并请求

获取与议题相关的所有合并请求。

如果项目是私有的或议题是机密的,您需要提供凭据进行授权。推荐的方式是使用 个人访问令牌

GET /projects/:id/issues/:issue_iid/related_merge_requests

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

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

响应示例:

[
  {
    "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": [],
    "draft": false,
    "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://jihulab.com/gitlab-cn/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
    }
  }
]

列出合并时关闭特定议题的合并请求

获取所有在合并时关闭特定议题的合并请求。

如果项目是私有的或议题是机密的,您需要提供凭据进行授权。推荐的方式是使用 个人访问令牌

GET /projects/:id/issues/:issue_iid/closed_by

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

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

响应示例:

[
  {
    "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": "main",
    "source_branch": "feature.custom-highlighting",
    "upvotes": 0,
    "downvotes": 0,
    "author": {
      "name": "管理员",
      "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": [],
    "draft": false,
    "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
    }
  }
]

列出议题的参与者

列出议题中的参与用户。

如果项目是私有的或议题是机密的,您需要提供凭据进行授权。推荐的方式是使用 个人访问令牌

GET /projects/:id/issues/:issue_iid/participants

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/participants"

响应示例:

[
  {
    "id": 1,
    "name": "John Doe1",
    "username": "user1",
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
    "web_url": "http://gitlab.example.com/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://gitlab.example.com/user5"
  }
]

议题上的评论

使用 Notes API 进行评论交互。

获取用户代理详情

仅对管理员可用。

获取创建议题的用户的用户代理字符串和 IP,用于垃圾邮件跟踪。

GET /projects/:id/issues/:issue_iid/user_agent_detail

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/user_agent_detail"

响应示例:

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

列出议题状态事件

要跟踪设置了哪个状态、谁设置的以及何时发生的,请使用 资源状态事件 API

事件

以下请求仅适用于 事件

上传指标图像

仅适用于 事件

上传指标图表的截图以显示在事件的 指标 标签页中。上传图像时,可以将图像与文本或链接到原始图表关联。如果添加了 URL,可以通过选择上传图像上方的超链接来访问原始图表。

POST /projects/:id/issues/:issue_iid/metric_images

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。
file file 要上传的图像文件。
url string 查看更多指标信息的 URL。
url_text string 图像或 URL 的描述。

请求示例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --form 'file=@/path/to/file.png' \
  --form 'url=http://example.com' \
  --form 'url_text=Example website' \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/metric_images"

响应示例:

{
    "id": 23,
    "created_at": "2020-11-13T00:06:18.084Z",
    "filename": "file.png",
    "file_path": "/uploads/-/system/issuable_metric_image/file/23/file.png",
    "url": "http://example.com",
    "url_text": "Example website"
}

列出指标图像

仅适用于 事件

列出事件的 指标 标签页中显示的指标图表的截图。

GET /projects/:id/issues/:issue_iid/metric_images

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。

请求示例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/metric_images"

响应示例:

[
    {
        "id": 17,
        "created_at": "2020-11-12T20:07:58.156Z",
        "filename": "sample_2054",
        "file_path": "/uploads/-/system/issuable_metric_image/file/17/sample_2054.png",
        "url": "example.com/metric"
    },
    {
        "id": 18,
        "created_at": "2020-11-12T20:14:26.441Z",
        "filename": "sample_2054",
        "file_path": "/uploads/-/system/issuable_metric_image/file/18/sample_2054.png",
        "url": "example.com/metric"
    }
]

更新指标图像

仅适用于 事件

编辑在事件的 指标 标签页中显示的指标图表截图的属性。

PUT /projects/:id/issues/:issue_iid/metric_images/:image_id

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。
image_id integer 图像的 ID。
url string 查看更多指标信息的 URL。
url_text string 图像或 URL 的描述。

请求示例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --request PUT \
  --form 'url=http://example.com' \
  --form 'url_text=Example website' \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/metric_images/1"

响应示例:

{
    "id": 23,
    "created_at": "2020-11-13T00:06:18.084Z",
    "filename": "file.png",
    "file_path": "/uploads/-/system/issuable_metric_image/file/23/file.png",
    "url": "http://example.com",
    "url_text": "Example website"
}

删除指标图像

仅适用于 事件

删除在事件的 指标 标签页中显示的指标图表的截图。

DELETE /projects/:id/issues/:issue_iid/metric_images/:image_id

支持的属性:

属性 类型 必需 描述
id integer/string 项目的全局 ID 或 URL 编码路径
issue_iid integer 项目议题的内部 ID。
image_id integer 图像的 ID。

请求示例:

curl --header "PRIVATE-TOKEN: <your_access_token>" \
  --request DELETE \
  --url "https://gitlab.example.com/api/v4/projects/5/issues/93/metric_images/1"

可返回以下状态码:

  • 204 No Content,如果图像删除成功。
  • 400 Bad Request,如果图像无法删除。 ```