史诗链接 API

  • Tier: 旗舰版
  • Offering: JihuLab.com, 私有化部署
极狐GitLab 17.0 中史诗 REST API 已被弃用,并计划在 API 的 v5 中移除。在极狐GitLab 17.4 或更高版本中,如果启用了[史诗的新外观](../user/group/epics/epic_work_items.md),请改用工作项 API。有关更多信息,请参阅[如何迁移现有 API 的指南](graphql/epic_work_items_api_migration_guide.md)。此更改是一个重大更改。

管理父子 史诗关系

每次对 epic_links 的 API 调用都必须经过认证。

如果用户不是一个私有群组的成员,则对该群组进行 GET 请求会导致返回 404 状态码。

多级史诗仅在 极狐GitLab 旗舰版 中可用。如果多级史诗功能不可用,则返回 403 状态码。

获取某个史诗的所有子史诗。

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

示例响应:

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

指派一个子史诗#

在两个史诗之间创建一个关联,将一个设定为父史诗,另一个设定为子史诗。一个父史诗可以有多个子史诗。如果新的子史诗已经属于另一个史诗,它将从之前的父史诗中取消分配。

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

示例响应:

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

创建并指派一个子史诗#

创建一个新的史诗并与提供的父史诗关联。响应是 LinkedEpic 对象。

plaintext
POST /groups/:id/epics/:epic_iid/epics
属性类型必需描述
idinteger/string群组的 ID 或 URL 编码路径
epic_iidinteger(未来父)史诗的内部 ID。
titlestring新创建的史诗的标题。
confidentialboolean史诗是否应该保密。如果 confidential_epics 特性标志被禁用,则参数被忽略。默认情况下与父史诗的保密状态一致。
shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/5/epics?title=Newpic"

示例响应:

json
1{ 2 "id": 24, 3 "iid": 2, 4 "title": "child epic", 5 "group_id": 49, 6 "parent_id": 23, 7 "has_children": false, 8 "has_issues": false, 9 "reference": "&2", 10 "url": "http://localhost/groups/group16/-/epics/2", 11 "relation_url": "http://localhost/groups/group16/-/epics/1/links/24" 12}

重新排序子史诗#

plaintext
PUT /groups/:id/epics/:epic_iid/epics/:child_epic_id
属性类型必需描述
idinteger/string群组的 ID 或 URL 编码路径
epic_iidinteger史诗的内部 ID。
child_epic_idinteger子史诗的全局 ID。内部 ID 不能使用,因为它们可能与其他群组的史诗冲突。
move_before_idinteger应该放置在子史诗之前的兄弟史诗的全局 ID。
move_after_idinteger应该放置在子史诗之后的兄弟史诗的全局 ID。
shell
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/4/epics/5"

示例响应:

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

取消指派子史诗#

从父史诗中取消指派一个子史诗。

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

示例响应:

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