关联史诗 API

  • Tier: 旗舰版
  • Offering: JihuLab.com, 私有化部署
History
    • 引入于极狐GitLab 14.9,使用名为 related_epics_widget功能标志。默认启用。
    • 功能标志在极狐GitLab 15.0 中被移除。
史诗 REST API 在极狐GitLab 17.0 中被弃用并计划在 API v5 中被移除。在极狐GitLab 17.4 或以后版本,如果启用了[新的史诗外观](../user/group/epics/epic_work_items.md),请使用工作项 API 取而代之。更多详情,可以查看[如何迁移极有 API 指南](graphql/epic_work_items_api_migration_guide.md)。此变更是一个破坏性变更。

如果在您的极狐GitLab 计划中关联史诗功能不可用,会返回一个 403 状态码。

获取给定群组及其子群组中相关史诗链接的列表,并根据用户授权进行过滤。用户需要有访问 source_epictarget_epic 的权限才能访问相关史诗链接。

plaintext
GET /groups/:id/related_epic_links

支持的属性:

属性类型是否必填描述
idinteger/string群组的 ID 或 URL 编码的路径
created_afterstring返回在给定时间或之后创建的相关史诗链接。格式:ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)
created_beforestring返回在给定时间或之前创建的相关史诗链接。格式:ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)
updated_afterstring返回在给定时间或之后更新的相关史诗链接。格式:ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)
updated_beforestring返回在给定时间或之前更新的相关史诗链接。格式:ISO 8601 (YYYY-MM-DDTHH:MM:SSZ)

示例请求:

shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/:id/related_epic_links"

示例响应:

json
1[ 2 { 3 "id": 1, 4 "created_at": "2022-01-31T15:10:44.988Z", 5 "updated_at": "2022-01-31T15:10:44.988Z", 6 "link_type": "relates_to", 7 "source_epic": { 8 "id": 21, 9 "iid": 1, 10 "color": "#1068bf", 11 "text_color": "#FFFFFF", 12 "group_id": 26, 13 "parent_id": null, 14 "parent_iid": null, 15 "title": "Aspernatur recusandae distinctio omnis et qui est iste.", 16 "description": "some description", 17 "confidential": false, 18 "author": { 19 "id": 15, 20 "username": "trina", 21 "name": "Theresia Robel", 22 "state": "active", 23 "avatar_url": "https://www.gravatar.com/avatar/085e28df717e16484cbf6ceca75e9a93?s=80&d=identicon", 24 "web_url": "http://gitlab.example.com/trina" 25 }, 26 "start_date": null, 27 "end_date": null, 28 "due_date": null, 29 "state": "opened", 30 "web_url": "http://gitlab.example.com/groups/flightjs/-/epics/1", 31 "references": { 32 "short": "&1", 33 "relative": "&1", 34 "full": "flightjs&1" 35 }, 36 "created_at": "2022-01-31T15:10:44.988Z", 37 "updated_at": "2022-03-16T09:32:35.712Z", 38 "closed_at": null, 39 "labels": [], 40 "upvotes": 0, 41 "downvotes": 0, 42 "_links": { 43 "self": "http://gitlab.example.com/api/v4/groups/26/epics/1", 44 "epic_issues": "http://gitlab.example.com/api/v4/groups/26/epics/1/issues", 45 "group": "http://gitlab.example.com/api/v4/groups/26", 46 "parent": null 47 } 48 }, 49 "target_epic": { 50 "id": 25, 51 "iid": 5, 52 "color": "#1068bf", 53 "text_color": "#FFFFFF", 54 "group_id": 26, 55 "parent_id": null, 56 "parent_iid": null, 57 "title": "Aut assumenda id nihil distinctio fugiat vel numquam est.", 58 "description": "some description", 59 "confidential": false, 60 "author": { 61 "id": 3, 62 "username": "valerie", 63 "name": "Erika Wolf", 64 "state": "active", 65 "avatar_url": "https://www.gravatar.com/avatar/9ef7666abb101418a4716a8ed4dded80?s=80&d=identicon", 66 "web_url": "http://gitlab.example.com/valerie" 67 }, 68 "start_date": null, 69 "end_date": null, 70 "due_date": null, 71 "state": "opened", 72 "web_url": "http://gitlab.example.com/groups/flightjs/-/epics/5", 73 "references": { 74 "short": "&5", 75 "relative": "&5", 76 "full": "flightjs&5" 77 }, 78 "created_at": "2022-01-31T15:10:45.080Z", 79 "updated_at": "2022-03-16T09:32:35.842Z", 80 "closed_at": null, 81 "labels": [], 82 "upvotes": 0, 83 "downvotes": 0, 84 "_links": { 85 "self": "http://gitlab.example.com/api/v4/groups/26/epics/5", 86 "epic_issues": "http://gitlab.example.com/api/v4/groups/26/epics/5/issues", 87 "group": "http://gitlab.example.com/api/v4/groups/26", 88 "parent": null 89 } 90 }, 91 } 92]

从史诗中列出相关史诗#

获取给定史诗的相关史诗列表,并根据用户授权进行过滤。

plaintext
GET /groups/:id/epics/:epic_iid/related_epics

支持的属性:

属性类型是否必填描述
epic_iidinteger群组史诗的内部 ID
idinteger/string群组的 ID 或 URL 编码的路径

示例请求:

shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/:id/epics/:epic_iid/related_epics"

示例响应:

json
1[ 2 { 3 "id":2, 4 "iid":2, 5 "color":"#1068bf", 6 "text_color":"#FFFFFF", 7 "group_id":2, 8 "parent_id":null, 9 "parent_iid":null, 10 "title":"My title 2", 11 "description":null, 12 "confidential":false, 13 "author":{ 14 "id":3, 15 "username":"user3", 16 "name":"Sidney Jones4", 17 "state":"active", 18 "avatar_url":"https://www.gravatar.com/avatar/82797019f038ab535a84c6591e7bc936?s=80u0026d=identicon", 19 "web_url":"http://localhost/user3" 20 }, 21 "start_date":null, 22 "end_date":null, 23 "due_date":null, 24 "state":"opened", 25 "web_url":"http://localhost/groups/group1/-/epics/2", 26 "references":{ 27 "short":"u00262", 28 "relative":"u00262", 29 "full":"group1u00262" 30 }, 31 "created_at":"2022-03-10T18:35:24.479Z", 32 "updated_at":"2022-03-10T18:35:24.479Z", 33 "closed_at":null, 34 "labels":[ 35 36 ], 37 "upvotes":0, 38 "downvotes":0, 39 "_links":{ 40 "self":"http://localhost/api/v4/groups/2/epics/2", 41 "epic_issues":"http://localhost/api/v4/groups/2/epics/2/issues", 42 "group":"http://localhost/api/v4/groups/2", 43 "parent":null 44 }, 45 "related_epic_link_id":1, 46 "link_type":"relates_to", 47 "link_created_at":"2022-03-10T18:35:24.496+00:00", 48 "link_updated_at":"2022-03-10T18:35:24.496+00:00" 49 } 50]
History
    • 在极狐GitLab 15.8 中,群组最小所需的角色从报告者更改为访客。

在两个史诗之间创建双向关系。用户必须至少拥有两个群组的 Guest 角色。

plaintext
POST /groups/:id/epics/:epic_iid/related_epics

支持的属性:

属性类型是否必填描述
epic_iidinteger群组史诗的内部 ID。
idinteger/string群组的 ID 或 URL 编码的路径
target_epic_iidinteger/string目标群组史诗的内部 ID。
target_group_idinteger/string目标群组的 ID 或 URL 编码的路径
link_typestring关系类型 (relates_to, blocks, is_blocked_by),默认为 relates_to

示例请求:

shell
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/26/epics/1/related_epics?target_group_id=26&target_epic_iid=5"

示例响应:

json
1{ 2 "id": 1, 3 "created_at": "2022-01-31T15:10:44.988Z", 4 "updated_at": "2022-01-31T15:10:44.988Z", 5 "link_type": "relates_to", 6 "source_epic": { 7 "id": 21, 8 "iid": 1, 9 "color": "#1068bf", 10 "text_color": "#FFFFFF", 11 "group_id": 26, 12 "parent_id": null, 13 "parent_iid": null, 14 "title": "Aspernatur recusandae distinctio omnis et qui est iste.", 15 "description": "some description", 16 "confidential": false, 17 "author": { 18 "id": 15, 19 "username": "trina", 20 "name": "Theresia Robel", 21 "state": "active", 22 "avatar_url": "https://www.gravatar.com/avatar/085e28df717e16484cbf6ceca75e9a93?s=80&d=identicon", 23 "web_url": "http://gitlab.example.com/trina" 24 }, 25 "start_date": null, 26 "end_date": null, 27 "due_date": null, 28 "state": "opened", 29 "web_url": "http://gitlab.example.com/groups/flightjs/-/epics/1", 30 "references": { 31 "short": "&1", 32 "relative": "&1", 33 "full": "flightjs&1" 34 }, 35 "created_at": "2022-01-31T15:10:44.988Z", 36 "updated_at": "2022-03-16T09:32:35.712Z", 37 "closed_at": null, 38 "labels": [], 39 "upvotes": 0, 40 "downvotes": 0, 41 "_links": { 42 "self": "http://gitlab.example.com/api/v4/groups/26/epics/1", 43 "epic_issues": "http://gitlab.example.com/api/v4/groups/26/epics/1/issues", 44 "group": "http://gitlab.example.com/api/v4/groups/26", 45 "parent": null 46 } 47 }, 48 "target_epic": { 49 "id": 25, 50 "iid": 5, 51 "color": "#1068bf", 52 "text_color": "#FFFFFF", 53 "group_id": 26, 54 "parent_id": null, 55 "parent_iid": null, 56 "title": "Aut assumenda id nihil distinctio fugiat vel numquam est.", 57 "description": "some description", 58 "confidential": false, 59 "author": { 60 "id": 3, 61 "username": "valerie", 62 "name": "Erika Wolf", 63 "state": "active", 64 "avatar_url": "https://www.gravatar.com/avatar/9ef7666abb101418a4716a8ed4dded80?s=80&d=identicon", 65 "web_url": "http://gitlab.example.com/valerie" 66 }, 67 "start_date": null, 68 "end_date": null, 69 "due_date": null, 70 "state": "opened", 71 "web_url": "http://gitlab.example.com/groups/flightjs/-/epics/5", 72 "references": { 73 "short": "&5", 74 "relative": "&5", 75 "full": "flightjs&5" 76 }, 77 "created_at": "2022-01-31T15:10:45.080Z", 78 "updated_at": "2022-03-16T09:32:35.842Z", 79 "closed_at": null, 80 "labels": [], 81 "upvotes": 0, 82 "downvotes": 0, 83 "_links": { 84 "self": "http://gitlab.example.com/api/v4/groups/26/epics/5", 85 "epic_issues": "http://gitlab.example.com/api/v4/groups/26/epics/5/issues", 86 "group": "http://gitlab.example.com/api/v4/groups/26", 87 "parent": null 88 } 89 }, 90}
History
    • 在极狐GitLab 15.8 中,群组最小所需的角色从报告者更改为访客。

删除两个史诗之间的双向关系。用户必须至少拥有两个群组的 Guest 角色。

plaintext
DELETE /groups/:id/epics/:epic_iid/related_epics/:related_epic_link_id

支持的属性:

属性类型是否必填描述
epic_iidinteger群组史诗的内部 ID。
idinteger/string群组的 ID 或 URL 编码的路径
related_epic_link_idinteger/string相关史诗链接的内部 ID。

示例请求:

shell
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/26/epics/1/related_epics/1"

示例响应:

json
1{ 2 "id": 1, 3 "created_at": "2022-01-31T15:10:44.988Z", 4 "updated_at": "2022-01-31T15:10:44.988Z", 5 "link_type": "relates_to", 6 "source_epic": { 7 "id": 21, 8 "iid": 1, 9 "color": "#1068bf", 10 "text_color": "#FFFFFF", 11 "group_id": 26, 12 "parent_id": null, 13 "parent_iid": null, 14 "title": "Aspernatur recusandae distinctio omnis et qui est iste.", 15 "description": "some description", 16 "confidential": false, 17 "author": { 18 "id": 15, 19 "username": "trina", 20 "name": "Theresia Robel", 21 "state": "active", 22 "avatar_url": "https://www.gravatar.com/avatar/085e28df717e16484cbf6ceca75e9a93?s=80&d=identicon", 23 "web_url": "http://gitlab.example.com/trina" 24 }, 25 "start_date": null, 26 "end_date": null, 27 "due_date": null, 28 "state": "opened", 29 "web_url": "http://gitlab.example.com/groups/flightjs/-/epics/1", 30 "references": { 31 "short": "&1", 32 "relative": "&1", 33 "full": "flightjs&1" 34 }, 35 "created_at": "2022-01-31T15:10:44.988Z", 36 "updated_at": "2022-03-16T09:32:35.712Z", 37 "closed_at": null, 38 "labels": [], 39 "upvotes": 0, 40 "downvotes": 0, 41 "_links": { 42 "self": "http://gitlab.example.com/api/v4/groups/26/epics/1", 43 "epic_issues": "http://gitlab.example.com/api/v4/groups/26/epics/1/issues", 44 "group": "http://gitlab.example.com/api/v4/groups/26", 45 "parent": null 46 } 47 }, 48 "target_epic": { 49 "id": 25, 50 "iid": 5, 51 "color": "#1068bf", 52 "text_color": "#FFFFFF", 53 "group_id": 26, 54 "parent_id": null, 55 "parent_iid": null, 56 "title": "Aut assumenda id nihil distinctio fugiat vel numquam est.", 57 "description": "some description", 58 "confidential": false, 59 "author": { 60 "id": 3, 61 "username": "valerie", 62 "name": "Erika Wolf", 63 "state": "active", 64 "avatar_url": "https://www.gravatar.com/avatar/9ef7666abb101418a4716a8ed4dded80?s=80&d=identicon", 65 "web_url": "http://gitlab.example.com/valerie" 66 }, 67 "start_date": null, 68 "end_date": null, 69 "due_date": null, 70 "state": "opened", 71 "web_url": "http://gitlab.example.com/groups/flightjs/-/epics/5", 72 "references": { 73 "short": "&5", 74 "relative": "&5", 75 "full": "flightjs&5" 76 }, 77 "created_at": "2022-01-31T15:10:45.080Z", 78 "updated_at": "2022-03-16T09:32:35.842Z", 79 "closed_at": null, 80 "labels": [], 81 "upvotes": 0, 82 "downvotes": 0, 83 "_links": { 84 "self": "http://gitlab.example.com/api/v4/groups/26/epics/5", 85 "epic_issues": "http://gitlab.example.com/api/v4/groups/26/epics/5/issues", 86 "group": "http://gitlab.example.com/api/v4/groups/26", 87 "parent": null 88 } 89 }, 90}