2019-07-08 04:50:38 -04:00
|
|
|
# Issue links API **(STARTER)**
|
2019-05-18 17:27:41 -04:00
|
|
|
|
|
|
|
## List issue relations
|
|
|
|
|
|
|
|
Get a list of related issues of a given issue, sorted by the relationship creation datetime (ascending).
|
|
|
|
Issues will be filtered according to the user authorizations.
|
|
|
|
|
2020-02-27 04:09:01 -05:00
|
|
|
```plaintext
|
2019-05-18 17:27:41 -04:00
|
|
|
GET /projects/:id/issues/:issue_iid/links
|
|
|
|
```
|
|
|
|
|
|
|
|
Parameters:
|
|
|
|
|
|
|
|
| Attribute | Type | Required | Description |
|
|
|
|
|-------------|---------|----------|--------------------------------------|
|
|
|
|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
|
|
|
| `issue_iid` | integer | yes | The internal ID of a project's issue |
|
|
|
|
|
|
|
|
```json
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"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,
|
2020-01-08 13:07:32 -05:00
|
|
|
"link_type": "relates_to"
|
2019-05-18 17:27:41 -04:00
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
## Create an issue link
|
|
|
|
|
|
|
|
Creates a two-way relation between two issues. User must be allowed to update both issues in order to succeed.
|
|
|
|
|
2020-02-27 04:09:01 -05:00
|
|
|
```plaintext
|
2019-12-20 13:07:53 -05:00
|
|
|
POST /projects/:id/issues/:issue_iid/links
|
2019-05-18 17:27:41 -04:00
|
|
|
```
|
|
|
|
|
|
|
|
| Attribute | Type | Required | Description |
|
|
|
|
|-------------|---------|----------|--------------------------------------|
|
|
|
|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
|
|
|
| `issue_iid` | integer | yes | The internal ID of a project's issue |
|
|
|
|
| `target_project_id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) of a target project |
|
|
|
|
| `target_issue_iid` | integer/string | yes | The internal ID of a target project's issue |
|
2020-02-07 13:09:03 -05:00
|
|
|
| `link_type` | string | no | The type of the relation ("relates_to", "blocks", "is_blocked_by"), defaults to "relates_to"). |
|
2019-05-18 17:27:41 -04:00
|
|
|
|
2020-01-30 10:09:15 -05:00
|
|
|
```shell
|
2019-12-20 13:07:53 -05:00
|
|
|
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"
|
|
|
|
```
|
|
|
|
|
|
|
|
Example response:
|
|
|
|
|
2019-05-18 17:27:41 -04:00
|
|
|
```json
|
|
|
|
{
|
|
|
|
"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,
|
2020-01-08 13:07:32 -05:00
|
|
|
},
|
|
|
|
"link_type": "relates_to"
|
2019-05-18 17:27:41 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Delete an issue link
|
|
|
|
|
|
|
|
Deletes an issue link, thus removes the two-way relationship.
|
|
|
|
|
2020-02-27 04:09:01 -05:00
|
|
|
```plaintext
|
2019-05-18 17:27:41 -04:00
|
|
|
DELETE /projects/:id/issues/:issue_iid/links/:issue_link_id
|
|
|
|
```
|
|
|
|
|
|
|
|
| Attribute | Type | Required | Description |
|
|
|
|
|-------------|---------|----------|--------------------------------------|
|
|
|
|
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
|
|
|
| `issue_iid` | integer | yes | The internal ID of a project's issue |
|
|
|
|
| `issue_link_id` | integer/string | yes | The ID of an issue relationship |
|
2020-01-08 13:07:32 -05:00
|
|
|
| `link_type` | string | no | The type of the relation ('relates_to', 'blocks', 'is_blocked_by'), defaults to 'relates_to' |
|
2019-05-18 17:27:41 -04:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"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,
|
2020-01-08 13:07:32 -05:00
|
|
|
},
|
|
|
|
"link_type": "relates_to"
|
2019-05-18 17:27:41 -04:00
|
|
|
}
|
|
|
|
```
|