议题链接 API

  • Tier: 基础版, 专业版, 旗舰版
  • Offering: JihuLab.com, 私有化部署
History
    • 简单的“相关”关系在极狐GitLab 13.4 中移动至基础版。

列出议题关系#

获取给定议题的关联议题列表,按关系创建日期时间升序排序。议题根据用户授权进行筛选。

plaintext
GET /projects/:id/issues/:issue_iid/links

参数:

属性类型必需描述
idinteger/string项目的 ID 或 URL 编码路径
issue_iidinteger项目议题的内部 ID
json
1[ 2 { 3 "id" : 84, 4 "iid" : 14, 5 "issue_link_id": 1, 6 "project_id" : 4, 7 "created_at" : "2016-01-07T12:44:33.959Z", 8 "title" : "Issues with auth", 9 "state" : "opened", 10 "assignees" : [], 11 "assignee" : null, 12 "labels" : [ 13 "bug" 14 ], 15 "author" : { 16 "name" : "Alexandra Bashirian", 17 "avatar_url" : null, 18 "state" : "active", 19 "web_url" : "https://gitlab.example.com/eileen.lowe", 20 "id" : 18, 21 "username" : "eileen.lowe" 22 }, 23 "description" : null, 24 "updated_at" : "2016-01-07T12:44:33.959Z", 25 "milestone" : null, 26 "user_notes_count": 0, 27 "due_date": null, 28 "web_url": "http://example.com/example/example/issues/14", 29 "confidential": false, 30 "weight": null, 31 "link_type": "relates_to", 32 "link_created_at": "2016-01-07T12:44:33.959Z", 33 "link_updated_at": "2016-01-07T12:44:33.959Z" 34 } 35]
History
    • 引入于极狐GitLab 15.1。

获取议题链接的详细信息。

plaintext
GET /projects/:id/issues/:issue_iid/links/:issue_link_id

支持的属性:

属性类型必需描述
idinteger/string项目的 ID 或 URL 编码路径
issue_iidinteger项目议题的内部 ID
issue_link_idinteger/string议题关系的 ID

响应体属性:

属性类型描述
source_issueobject关系的源议题详情
target_issueobject关系的目标议题详情
link_typestring关系类型。可能的值有 relates_toblocksis_blocked_by

示例请求:

shell
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/84/issues/14/links/1"

示例响应:

json
1{ 2 "source_issue" : { 3 "id" : 83, 4 "iid" : 11, 5 "project_id" : 4, 6 "created_at" : "2016-01-07T12:44:33.959Z", 7 "title" : "Issues with auth", 8 "state" : "opened", 9 "assignees" : [], 10 "assignee" : null, 11 "labels" : [ 12 "bug" 13 ], 14 "author" : { 15 "name" : "Alexandra Bashirian", 16 "avatar_url" : null, 17 "state" : "active", 18 "web_url" : "https://gitlab.example.com/eileen.lowe", 19 "id" : 18, 20 "username" : "eileen.lowe" 21 }, 22 "description" : null, 23 "updated_at" : "2016-01-07T12:44:33.959Z", 24 "milestone" : null, 25 "subscribed" : true, 26 "user_notes_count": 0, 27 "due_date": null, 28 "web_url": "http://example.com/example/example/issues/11", 29 "confidential": false, 30 "weight": null 31 }, 32 "target_issue" : { 33 "id" : 84, 34 "iid" : 14, 35 "project_id" : 4, 36 "created_at" : "2016-01-07T12:44:33.959Z", 37 "title" : "Issues with auth", 38 "state" : "opened", 39 "assignees" : [], 40 "assignee" : null, 41 "labels" : [ 42 "bug" 43 ], 44 "author" : { 45 "name" : "Alexandra Bashirian", 46 "avatar_url" : null, 47 "state" : "active", 48 "web_url" : "https://gitlab.example.com/eileen.lowe", 49 "id" : 18, 50 "username" : "eileen.lowe" 51 }, 52 "description" : null, 53 "updated_at" : "2016-01-07T12:44:33.959Z", 54 "milestone" : null, 55 "subscribed" : true, 56 "user_notes_count": 0, 57 "due_date": null, 58 "web_url": "http://example.com/example/example/issues/14", 59 "confidential": false, 60 "weight": null 61 }, 62 "link_type": "relates_to" 63}

在两个议题之间创建双向关系。用户必须被允许更新两个议题才能成功。

plaintext
POST /projects/:id/issues/:issue_iid/links
属性类型必需描述
idinteger/string项目的 ID 或 URL 编码路径
issue_iidinteger项目议题的内部 ID
target_project_idinteger/string目标项目的 ID 或 URL 编码路径
target_issue_iidinteger/string目标项目议题的内部 ID
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/projects/4/issues/1/links?target_project_id=5&target_issue_iid=1"

示例响应:

json
1{ 2 "source_issue" : { 3 "id" : 83, 4 "iid" : 11, 5 "project_id" : 4, 6 "created_at" : "2016-01-07T12:44:33.959Z", 7 "title" : "Issues with auth", 8 "state" : "opened", 9 "assignees" : [], 10 "assignee" : null, 11 "labels" : [ 12 "bug" 13 ], 14 "author" : { 15 "name" : "Alexandra Bashirian", 16 "avatar_url" : null, 17 "state" : "active", 18 "web_url" : "https://gitlab.example.com/eileen.lowe", 19 "id" : 18, 20 "username" : "eileen.lowe" 21 }, 22 "description" : null, 23 "updated_at" : "2016-01-07T12:44:33.959Z", 24 "milestone" : null, 25 "subscribed" : true, 26 "user_notes_count": 0, 27 "due_date": null, 28 "web_url": "http://example.com/example/example/issues/11", 29 "confidential": false, 30 "weight": null 31 }, 32 "target_issue" : { 33 "id" : 84, 34 "iid" : 14, 35 "project_id" : 4, 36 "created_at" : "2016-01-07T12:44:33.959Z", 37 "title" : "Issues with auth", 38 "state" : "opened", 39 "assignees" : [], 40 "assignee" : null, 41 "labels" : [ 42 "bug" 43 ], 44 "author" : { 45 "name" : "Alexandra Bashirian", 46 "avatar_url" : null, 47 "state" : "active", 48 "web_url" : "https://gitlab.example.com/eileen.lowe", 49 "id" : 18, 50 "username" : "eileen.lowe" 51 }, 52 "description" : null, 53 "updated_at" : "2016-01-07T12:44:33.959Z", 54 "milestone" : null, 55 "subscribed" : true, 56 "user_notes_count": 0, 57 "due_date": null, 58 "web_url": "http://example.com/example/example/issues/14", 59 "confidential": false, 60 "weight": null 61 }, 62 "link_type": "relates_to" 63}

删除议题链接,从而移除双向关系。

plaintext
DELETE /projects/:id/issues/:issue_iid/links/:issue_link_id
属性类型必需描述
idinteger/string项目的 ID 或 URL 编码路径
issue_iidinteger项目议题的内部 ID
issue_link_idinteger/string议题关系的 ID
link_typestring关系类型 (relates_to, blocks, is_blocked_by),默认为 relates_to
json
1{ 2 "source_issue" : { 3 "id" : 83, 4 "iid" : 11, 5 "project_id" : 4, 6 "created_at" : "2016-01-07T12:44:33.959Z", 7 "title" : "Issues with auth", 8 "state" : "opened", 9 "assignees" : [], 10 "assignee" : null, 11 "labels" : [ 12 "bug" 13 ], 14 "author" : { 15 "name" : "Alexandra Bashirian", 16 "avatar_url" : null, 17 "state" : "active", 18 "web_url" : "https://gitlab.example.com/eileen.lowe", 19 "id" : 18, 20 "username" : "eileen.lowe" 21 }, 22 "description" : null, 23 "updated_at" : "2016-01-07T12:44:33.959Z", 24 "milestone" : null, 25 "subscribed" : true, 26 "user_notes_count": 0, 27 "due_date": null, 28 "web_url": "http://example.com/example/example/issues/11", 29 "confidential": false, 30 "weight": null 31 }, 32 "target_issue" : { 33 "id" : 84, 34 "iid" : 14, 35 "project_id" : 4, 36 "created_at" : "2016-01-07T12:44:33.959Z", 37 "title" : "Issues with auth", 38 "state" : "opened", 39 "assignees" : [], 40 "assignee" : null, 41 "labels" : [ 42 "bug" 43 ], 44 "author" : { 45 "name" : "Alexandra Bashirian", 46 "avatar_url" : null, 47 "state" : "active", 48 "web_url" : "https://gitlab.example.com/eileen.lowe", 49 "id" : 18, 50 "username" : "eileen.lowe" 51 }, 52 "description" : null, 53 "updated_at" : "2016-01-07T12:44:33.959Z", 54 "milestone" : null, 55 "subscribed" : true, 56 "user_notes_count": 0, 57 "due_date": null, 58 "web_url": "http://example.com/example/example/issues/14", 59 "confidential": false, 60 "weight": null 61 }, 62 "link_type": "relates_to" 63}