Issue links API
Issue links API
List issue relations
获取给定问题的相关问题列表,按关系创建日期时间(升序)排序. 问题将根据用户授权进行过滤.
GET /projects/:id/issues/:issue_iid/links
Parameters:
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
issue_iid |
integer | yes | 项目问题的内部 ID |
[ { "id" : 84, "iid" : 14, "issue_link_id": 1 "project_id" : 4, "created_at" : "2016-01-07T12:44:33.959Z", "title" : "Issues with auth", "state" : "opened", "assignees" : [], "assignee" : null, "labels" : [ "bug" ], "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", "milestone" : null, "subscribed" : true, "user_notes_count": 0, "due_date": null, "web_url": "http://example.com/example/example/issues/14", "confidential": false, "weight": null, "link_type": "relates_to" } ]
Create an issue link
在两个问题之间创建双向关系. 必须允许用户更新两个问题才能成功.
POST /projects/:id/issues/:issue_iid/links
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
issue_iid |
integer | yes | 项目问题的内部 ID |
target_project_id |
integer/string | yes | 目标项目的项目的 ID 或URL 编码路径 |
target_issue_iid |
integer/string | yes | 目标项目的内部 ID |
link_type |
string | no | 关系的类型(” relates_to”,” blocks”,” is_blocked_by”)默认为” relates_to”. |
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"
响应示例:
{ "source_issue" : { "id" : 83, "iid" : 11, "project_id" : 4, "created_at" : "2016-01-07T12:44:33.959Z", "title" : "Issues with auth", "state" : "opened", "assignees" : [], "assignee" : null, "labels" : [ "bug" ], "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", "milestone" : null, "subscribed" : true, "user_notes_count": 0, "due_date": null, "web_url": "http://example.com/example/example/issues/11", "confidential": false, "weight": null, }, "target_issue" : { "id" : 84, "iid" : 14, "project_id" : 4, "created_at" : "2016-01-07T12:44:33.959Z", "title" : "Issues with auth", "state" : "opened", "assignees" : [], "assignee" : null, "labels" : [ "bug" ], "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", "milestone" : null, "subscribed" : true, "user_notes_count": 0, "due_date": null, "web_url": "http://example.com/example/example/issues/14", "confidential": false, "weight": null, }, "link_type": "relates_to" }
Delete an issue link
删除问题链接,从而删除双向关系.
DELETE /projects/:id/issues/:issue_iid/links/:issue_link_id
Attribute | Type | Required | Description |
---|---|---|---|
id |
integer/string | yes | 经过身份验证的用户拥有的项目的 ID 或URL 编码路径 |
issue_iid |
integer | yes | 项目问题的内部 ID |
issue_link_id |
integer/string | yes | 发行关系的 ID |
link_type |
string | no | 关系的类型(” relates_to”,” blocks”,” is_blocked_by”)默认为” relates_to” |
{ "source_issue" : { "id" : 83, "iid" : 11, "project_id" : 4, "created_at" : "2016-01-07T12:44:33.959Z", "title" : "Issues with auth", "state" : "opened", "assignees" : [], "assignee" : null, "labels" : [ "bug" ], "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", "milestone" : null, "subscribed" : true, "user_notes_count": 0, "due_date": null, "web_url": "http://example.com/example/example/issues/11", "confidential": false, "weight": null, }, "target_issue" : { "id" : 84, "iid" : 14, "project_id" : 4, "created_at" : "2016-01-07T12:44:33.959Z", "title" : "Issues with auth", "state" : "opened", "assignees" : [], "assignee" : null, "labels" : [ "bug" ], "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", "milestone" : null, "subscribed" : true, "user_notes_count": 0, "due_date": null, "web_url": "http://example.com/example/example/issues/14", "confidential": false, "weight": null, }, "link_type": "relates_to" }