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

Epic 链接 API

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

Epics REST API 在 GitLab 17.0 中已被弃用, 并计划在 API v5 版本中移除。 从 GitLab 17.4 到 18.0,如果启用了 epic 的新外观,以及在 GitLab 18.1 及更高版本中,请改用 Work Items API。更多信息,请参阅将 epic API 迁移到 work items。 此更改是一个破坏性变更。

管理父子 epic 关系

所有对 epic_links 的 API 调用都必须经过身份验证。

如果用户不是私有组的成员,对该组的 GET 请求将返回 404 状态码。

多级 Epic 仅在 GitLab Ultimate 中可用。 如果多级 Epic 功能不可用,将返回 403 状态码。

列出与给定 epic 相关的 epic

获取某个 epic 的所有子 epic。

GET /groups/:id/epics/:epic_iid/epics
属性 类型 是否必需 描述
id integer/string 组的 ID 或 URL 编码路径
epic_iid integer epic 的内部 ID。
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/5/epics/"

示例响应:

[
  {
    "id": 29,
    "iid": 6,
    "group_id": 1,
    "parent_id": 5,
    "title": "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",
    "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
    "author": {
      "id": 10,
      "name": "Lu Mayer",
      "username": "kam",
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
      "web_url": "http://localhost:3001/kam"
    },
    "start_date": null,
    "start_date_is_fixed": false,
    "start_date_fixed": null,
    "start_date_from_milestones": null,       //deprecated in favor of start_date_from_inherited_source
    "start_date_from_inherited_source": null,
    "end_date": "2018-07-31",                 //deprecated in favor of due_date
    "due_date": "2018-07-31",
    "due_date_is_fixed": false,
    "due_date_fixed": null,
    "due_date_from_milestones": "2018-07-31", //deprecated in favor of start_date_from_inherited_source
    "due_date_from_inherited_source": "2018-07-31",
    "created_at": "2018-07-17T13:36:22.770Z",
    "updated_at": "2018-07-18T12:22:05.239Z",
    "labels": []
  }
]

指派子 epic

在两个 epic 之间建立关联,将其中一个指定为父 epic,另一个指定为子 epic。一个父 epic 可以有多个子 epic。如果新的子 epic 已经属于另一个 epic,它将从先前的父 epic 中解除指派。

POST /groups/:id/epics/:epic_iid/epics/:child_epic_id
属性 类型 是否必需 描述
id integer/string 组的 ID 或 URL 编码路径
epic_iid integer epic 的内部 ID。
child_epic_id integer 子 epic 的全局 ID。不能使用内部 ID,因为它们可能会与其他组的 epic 冲突。
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/5/epics/6"

示例响应:

{
  "id": 6,
  "iid": 38,
  "group_id": 1,
  "parent_id": 5,
  "title": "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",
  "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
  "author": {
    "id": 10,
    "name": "Lu Mayer",
    "username": "kam",
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
    "web_url": "http://localhost:3001/kam"
  },
  "start_date": null,
  "start_date_is_fixed": false,
  "start_date_fixed": null,
  "start_date_from_milestones": null,       //deprecated in favor of start_date_from_inherited_source
  "start_date_from_inherited_source": null,
  "end_date": "2018-07-31",                 //deprecated in favor of due_date
  "due_date": "2018-07-31",
  "due_date_is_fixed": false,
  "due_date_fixed": null,
  "due_date_from_milestones": "2018-07-31", //deprecated in favor of start_date_from_inherited_source
  "due_date_from_inherited_source": "2018-07-31",
  "created_at": "2018-07-17T13:36:22.770Z",
  "updated_at": "2018-07-18T12:22:05.239Z",
  "labels": []
}

创建并指派子 epic

创建一个新的 epic 并将其与提供的父 epic 相关联。响应为 LinkedEpic 对象。

POST /groups/:id/epics/:epic_iid/epics
属性 类型 是否必需 描述
id integer/string 组的 ID 或 URL 编码路径
epic_iid integer (未来的父)epic 的内部 ID。
title string 新创建 epic 的标题。
confidential boolean epic 是否应设为机密。如果 confidential_epics 功能标志被禁用,则此参数将被忽略。默认为父 epic 的机密状态。
curl --request POST --header  "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/5/epics?title=Newpic"

示例响应:

{
  "id": 24,
  "iid": 2,
  "title": "child epic",
  "group_id": 49,
  "parent_id": 23,
  "has_children": false,
  "has_issues": false,
  "reference":  "&2",
  "url": "http://localhost/groups/group16/-/epics/2",
  "relation_url": "http://localhost/groups/group16/-/epics/1/links/24"
}

重新排序子 epic

PUT /groups/:id/epics/:epic_iid/epics/:child_epic_id
属性 类型 是否必需 描述
id integer/string 组的 ID 或 URL 编码路径
epic_iid integer epic 的内部 ID。
child_epic_id integer 子 epic 的全局 ID。不能使用内部 ID,因为它们可能会与其他组的 epic 冲突。
move_before_id integer 应放置在子 epic 之前的同级 epic 的全局 ID。
move_after_id integer 应放置在子 epic 之后的同级 epic 的全局 ID。
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/4/epics/5"

示例响应:

[
  {
    "id": 29,
    "iid": 6,
    "group_id": 1,
    "parent_id": 5,
    "title": "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",
    "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
    "author": {
      "id": 10,
      "name": "Lu Mayer",
      "username": "kam",
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
      "web_url": "http://localhost:3001/kam"
    },
    "start_date": null,
    "start_date_is_fixed": false,
    "start_date_fixed": null,
    "start_date_from_milestones": null,       //deprecated in favor of start_date_from_inherited_source
    "start_date_from_inherited_source": null,
    "end_date": "2018-07-31",                 //deprecated in favor of due_date
    "due_date": "2018-07-31",
    "due_date_is_fixed": false,
    "due_date_fixed": null,
    "due_date_from_milestones": "2018-07-31", //deprecated in favor of start_date_from_inherited_source
    "due_date_from_inherited_source": "2018-07-31",
    "created_at": "2018-07-17T13:36:22.770Z",
    "updated_at": "2018-07-18T12:22:05.239Z",
    "labels": []
  }
]

取消指派子 epic

从父 epic 中取消指派子 epic。

DELETE /groups/:id/epics/:epic_iid/epics/:child_epic_id
属性 类型 是否必需 描述
id integer/string 组的 ID 或 URL 编码路径
epic_iid integer epic 的内部 ID。
child_epic_id integer 子 epic 的全局 ID。不能使用内部 ID,因为它们可能会与其他组的 epic 冲突。
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/4/epics/5"

示例响应:

{
  "id": 5,
  "iid": 38,
  "group_id": 1,
  "parent_id": null,
  "title": "Accusamus iste et ullam ratione voluptatem omnis debitis dolor est.",
  "description": "Molestias dolorem eos vitae expedita impedit necessitatibus quo voluptatum.",
  "author": {
    "id": 10,
    "name": "Lu Mayer",
    "username": "kam",
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/018729e129a6f31c80a6327a30196823?s=80&d=identicon",
    "web_url": "http://localhost:3001/kam"
  },
  "start_date": null,
  "start_date_is_fixed": false,
  "start_date_fixed": null,
  "start_date_from_milestones": null,       //deprecated in favor of start_date_from_inherited_source
  "start_date_from_inherited_source": null,
  "end_date": "2018-07-31",                 //deprecated in favor of due_date
  "due_date": "2018-07-31",
  "due_date_is_fixed": false,
  "due_date_fixed": null,
  "due_date_from_milestones": "2018-07-31", //deprecated in favor of start_date_from_inherited_source
  "due_date_from_inherited_source": "2018-07-31",
  "created_at": "2018-07-17T13:36:22.770Z",
  "updated_at": "2018-07-18T12:22:05.239Z",
  "labels": []
}