issues.md 38.4 KB
Newer Older
1
# Issues API
Marin Jankovski's avatar
Marin Jankovski committed
2

3 4 5 6 7 8 9 10 11 12 13 14
Every API call to issues must be authenticated.

If a user is not a member of a project and the project is private, a `GET`
request on that project will result to a `404` status code.

## Issues pagination

By default, `GET` requests return 20 results at a time because the API results
are paginated.

Read more on [pagination](README.md#pagination).

Nihad Abbasov's avatar
Nihad Abbasov committed
15 16
## List issues

17
Get all issues created by the authenticated user.
Nihad Abbasov's avatar
Nihad Abbasov committed
18 19 20

```
GET /issues
jubianchi's avatar
jubianchi committed
21 22
GET /issues?state=opened
GET /issues?state=closed
jubianchi's avatar
jubianchi committed
23 24 25
GET /issues?labels=foo
GET /issues?labels=foo,bar
GET /issues?labels=foo,bar&state=opened
26 27
GET /issues?milestone=1.0.0
GET /issues?milestone=1.0.0&state=opened
28
GET /issues?iids[]=42&iids[]=43
29
GET /issues?search=issue+title+or+description
Nihad Abbasov's avatar
Nihad Abbasov committed
30 31
```

32
| Attribute   | Type           | Required | Description                                                                                                                 |
33
|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------|
34 35 36 37 38 39
| `state`     | string         | no       | Return all issues or just those that are `opened` or `closed`                                                               |
| `labels`    | string         | no       | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels |
| `milestone` | string         | no       | The milestone title                                                                                                         |
| `iids`      | Array[integer] | no       | Return only the issues having the given `iid`                                                                               |
| `order_by`  | string         | no       | Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at`                                     |
| `sort`      | string         | no       | Return requests sorted in `asc` or `desc` order. Default is `desc`                                                          |
40
| `search`    | string         | no       | Search issues against their `title` and `description`                                                                       |
41 42

```bash
43
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/issues
44
```
jubianchi's avatar
jubianchi committed
45

46
Example response:
jubianchi's avatar
jubianchi committed
47

Nihad Abbasov's avatar
Nihad Abbasov committed
48 49
```json
[
50 51 52 53 54 55
   {
      "state" : "opened",
      "description" : "Ratione dolores corrupti mollitia soluta quia.",
      "author" : {
         "state" : "active",
         "id" : 18,
56
         "web_url" : "https://gitlab.example.com/eileen.lowe",
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
         "name" : "Alexandra Bashirian",
         "avatar_url" : null,
         "username" : "eileen.lowe"
      },
      "milestone" : {
         "project_id" : 1,
         "description" : "Ducimus nam enim ex consequatur cumque ratione.",
         "state" : "closed",
         "due_date" : null,
         "iid" : 2,
         "created_at" : "2016-01-04T15:31:39.996Z",
         "title" : "v4.0",
         "id" : 17,
         "updated_at" : "2016-01-04T15:31:39.996Z"
      },
      "project_id" : 1,
73
      "assignees" : [{
74 75 76
         "state" : "active",
         "id" : 1,
         "name" : "Administrator",
77
         "web_url" : "https://gitlab.example.com/root",
78 79
         "avatar_url" : null,
         "username" : "root"
80
      }],
81 82 83 84 85 86 87 88
      "assignee" : {
         "state" : "active",
         "id" : 1,
         "name" : "Administrator",
         "web_url" : "https://gitlab.example.com/root",
         "avatar_url" : null,
         "username" : "root"
      },
89 90 91 92 93
      "updated_at" : "2016-01-04T15:31:51.081Z",
      "id" : 76,
      "title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
      "created_at" : "2016-01-04T15:31:51.081Z",
      "iid" : 6,
94
      "labels" : [],
95
      "user_notes_count": 1,
96
      "due_date": "2016-07-22",
97
      "web_url": "http://example.com/example/example/issues/6",
98 99
      "confidential": false,
      "weight": null
100
   }
Nihad Abbasov's avatar
Nihad Abbasov committed
101 102 103
]
```

104
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
105

106 107 108 109 110 111 112 113 114 115 116 117 118
## List group issues

Get a list of a group's issues.

```
GET /groups/:id/issues
GET /groups/:id/issues?state=opened
GET /groups/:id/issues?state=closed
GET /groups/:id/issues?labels=foo
GET /groups/:id/issues?labels=foo,bar
GET /groups/:id/issues?labels=foo,bar&state=opened
GET /groups/:id/issues?milestone=1.0.0
GET /groups/:id/issues?milestone=1.0.0&state=opened
119
GET /groups/:id/issues?iids[]=42&iids[]=43
120
GET /groups/:id/issues?search=issue+title+or+description
121 122
```

123
| Attribute   | Type           | Required | Description                                                                                                                 |
124
|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------|
Rémy Coutable's avatar
Rémy Coutable committed
125
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user               |
126 127 128 129 130 131 132
| `state`     | string         | no       | Return all issues or just those that are `opened` or `closed`                                                               |
| `labels`    | string         | no       | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels |
| `iids`      | Array[integer] | no       | Return only the issues having the given `iid`                                                                               |
| `milestone` | string         | no       | The milestone title                                                                                                         |
| `order_by`  | string         | no       | Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at`                                     |
| `sort`      | string         | no       | Return requests sorted in `asc` or `desc` order. Default is `desc`                                                          |
| `search`    | string         | no       | Search group issues against their `title` and `description`                                                                  |
133 134 135


```bash
136
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/groups/4/issues
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
```

Example response:

```json
[
   {
      "project_id" : 4,
      "milestone" : {
         "due_date" : null,
         "project_id" : 4,
         "state" : "closed",
         "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.",
         "iid" : 3,
         "id" : 11,
         "title" : "v3.0",
         "created_at" : "2016-01-04T15:31:39.788Z",
         "updated_at" : "2016-01-04T15:31:39.788Z"
      },
      "author" : {
         "state" : "active",
158
         "web_url" : "https://gitlab.example.com/root",
159 160 161 162 163 164 165 166
         "avatar_url" : null,
         "username" : "root",
         "id" : 1,
         "name" : "Administrator"
      },
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "state" : "closed",
      "iid" : 1,
167
      "assignees" : [{
168
         "avatar_url" : null,
169
         "web_url" : "https://gitlab.example.com/lennie",
170 171 172 173
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
174
      }],
175 176 177 178 179 180 181 182
      "assignee" : {
         "avatar_url" : null,
         "web_url" : "https://gitlab.example.com/lennie",
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
      },
183 184 185 186 187
      "labels" : [],
      "id" : 41,
      "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
      "updated_at" : "2016-01-04T15:31:46.176Z",
      "created_at" : "2016-01-04T15:31:46.176Z",
188
      "user_notes_count": 1,
189
      "due_date": null,
190
      "web_url": "http://example.com/example/example/issues/1",
191 192
      "confidential": false,
      "weight": null
193 194 195 196
   }
]
```

197
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
198

Nihad Abbasov's avatar
Nihad Abbasov committed
199 200
## List project issues

201
Get a list of a project's issues.
Nihad Abbasov's avatar
Nihad Abbasov committed
202 203 204

```
GET /projects/:id/issues
jubianchi's avatar
jubianchi committed
205 206
GET /projects/:id/issues?state=opened
GET /projects/:id/issues?state=closed
jubianchi's avatar
jubianchi committed
207 208 209
GET /projects/:id/issues?labels=foo
GET /projects/:id/issues?labels=foo,bar
GET /projects/:id/issues?labels=foo,bar&state=opened
210 211
GET /projects/:id/issues?milestone=1.0.0
GET /projects/:id/issues?milestone=1.0.0&state=opened
212
GET /projects/:id/issues?iids[]=42&iids[]=43
213
GET /projects/:id/issues?search=issue+title+or+description
Nihad Abbasov's avatar
Nihad Abbasov committed
214 215
```

216
| Attribute   | Type           | Required | Description                                                                                                                 |
217
|-------------|----------------|----------|-----------------------------------------------------------------------------------------------------------------------------|
218
| `id`        | integer/string        | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
219 220 221 222 223 224 225
| `iids`      | Array[integer] | no       | Return only the milestone having the given `iid`                                                                            |
| `state`     | string         | no       | Return all issues or just those that are `opened` or `closed`                                                               |
| `labels`    | string         | no       | Comma-separated list of label names, issues must have all labels to be returned. `No+Label` lists all issues with no labels |
| `milestone` | string         | no       | The milestone title                                                                                                         |
| `order_by`  | string         | no       | Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at`                                     |
| `sort`      | string         | no       | Return requests sorted in `asc` or `desc` order. Default is `desc`                                                          |
| `search`    | string         | no       | Search project issues against their `title` and `description`                                                                |
226 227
| `created_after` | datetime | no | Return issues created after the given time (inclusive) |
| `created_before` | datetime | no | Return issues created before the given time (inclusive) |
228 229

```bash
230
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/4/issues
231 232 233
```

Example response:
Nihad Abbasov's avatar
Nihad Abbasov committed
234

235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
```json
[
   {
      "project_id" : 4,
      "milestone" : {
         "due_date" : null,
         "project_id" : 4,
         "state" : "closed",
         "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.",
         "iid" : 3,
         "id" : 11,
         "title" : "v3.0",
         "created_at" : "2016-01-04T15:31:39.788Z",
         "updated_at" : "2016-01-04T15:31:39.788Z"
      },
      "author" : {
         "state" : "active",
252
         "web_url" : "https://gitlab.example.com/root",
253 254 255 256 257 258 259 260
         "avatar_url" : null,
         "username" : "root",
         "id" : 1,
         "name" : "Administrator"
      },
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "state" : "closed",
      "iid" : 1,
261
      "assignees" : [{
262
         "avatar_url" : null,
263
         "web_url" : "https://gitlab.example.com/lennie",
264 265 266 267
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
268
      }],
269 270 271 272 273 274 275 276
      "assignee" : {
         "avatar_url" : null,
         "web_url" : "https://gitlab.example.com/lennie",
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
      },
277 278 279 280
      "labels" : [],
      "id" : 41,
      "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
      "updated_at" : "2016-01-04T15:31:46.176Z",
281
      "created_at" : "2016-01-04T15:31:46.176Z",
282
      "user_notes_count": 1,
283
      "due_date": "2016-07-22",
284
      "web_url": "http://example.com/example/example/issues/1",
285 286
      "confidential": false,
      "weight": null
287 288 289
   }
]
```
290

291
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
292

Nihad Abbasov's avatar
Nihad Abbasov committed
293 294
## Single issue

295
Get a single project issue.
Nihad Abbasov's avatar
Nihad Abbasov committed
296 297

```
298
GET /projects/:id/issues/:issue_iid
Nihad Abbasov's avatar
Nihad Abbasov committed
299 300
```

301
| Attribute   | Type    | Required | Description                          |
302
|-------------|---------|----------|--------------------------------------|
303
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
304
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
Nihad Abbasov's avatar
Nihad Abbasov committed
305

306
```bash
307
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/4/issues/41
308 309 310
```

Example response:
Nihad Abbasov's avatar
Nihad Abbasov committed
311 312 313

```json
{
314 315 316 317 318 319 320 321 322 323 324 325 326 327
   "project_id" : 4,
   "milestone" : {
      "due_date" : null,
      "project_id" : 4,
      "state" : "closed",
      "description" : "Rerum est voluptatem provident consequuntur molestias similique ipsum dolor.",
      "iid" : 3,
      "id" : 11,
      "title" : "v3.0",
      "created_at" : "2016-01-04T15:31:39.788Z",
      "updated_at" : "2016-01-04T15:31:39.788Z"
   },
   "author" : {
      "state" : "active",
328
      "web_url" : "https://gitlab.example.com/root",
329 330 331 332 333 334 335 336
      "avatar_url" : null,
      "username" : "root",
      "id" : 1,
      "name" : "Administrator"
   },
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "state" : "closed",
   "iid" : 1,
337
   "assignees" : [{
338
      "avatar_url" : null,
339
      "web_url" : "https://gitlab.example.com/lennie",
340 341 342 343
      "state" : "active",
      "username" : "lennie",
      "id" : 9,
      "name" : "Dr. Luella Kovacek"
344
   }],
345 346 347 348 349 350 351 352
   "assignee" : {
      "avatar_url" : null,
      "web_url" : "https://gitlab.example.com/lennie",
      "state" : "active",
      "username" : "lennie",
      "id" : 9,
      "name" : "Dr. Luella Kovacek"
   },
353 354 355 356
   "labels" : [],
   "id" : 41,
   "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
   "updated_at" : "2016-01-04T15:31:46.176Z",
357
   "created_at" : "2016-01-04T15:31:46.176Z",
358
   "subscribed": false,
359
   "user_notes_count": 1,
360
   "due_date": null,
361
   "web_url": "http://example.com/example/example/issues/1",
362
   "confidential": false,
Lin Jen-Shin's avatar
Lin Jen-Shin committed
363
   "weight": null,
364 365 366 367 368 369
   "_links": {
      "self": "http://example.com/api/v4/projects/1/issues/2",
      "notes": "http://example.com/api/v4/projects/1/issues/2/notes",
      "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
      "project": "http://example.com/api/v4/projects/1"
   }
Nihad Abbasov's avatar
Nihad Abbasov committed
370 371 372
}
```

373
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
374

Nihad Abbasov's avatar
Nihad Abbasov committed
375 376
## New issue

377
Creates a new project issue.
Nihad Abbasov's avatar
Nihad Abbasov committed
378 379 380 381 382

```
POST /projects/:id/issues
```

Valery Sizov's avatar
Valery Sizov committed
383 384
| Attribute                                 | Type           | Required | Description  |
|-------------------------------------------|----------------|----------|--------------|
385
| `id`                                      | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
Valery Sizov's avatar
Valery Sizov committed
386 387 388 389 390 391 392 393 394 395 396
| `title`                                   | string         | yes      | The title of an issue |
| `description`                             | string         | no       | The description of an issue  |
| `confidential`                            | boolean        | no       | Set an issue to be confidential. Default is `false`.  |
| `assignee_ids`                            | Array[integer] | no       | The ID of a user to assign issue |
| `milestone_id`                            | integer        | no       | The ID of a milestone to assign issue  |
| `labels`                                  | string         | no       | Comma-separated label names for an issue  |
| `created_at`                              | string         | no       | Date time string, ISO 8601 formatted, e.g. `2016-03-11T03:45:40Z` (requires admin or project owner rights) |
| `due_date`                                | string         | no       | Date time string in the format YEAR-MONTH-DAY, e.g. `2016-03-11` |
| `merge_request_to_resolve_discussions_of` | integer        | no       | The IID of a merge request in which to resolve all issues. This will fill the issue with a default description and mark all discussions as resolved. When passing a description or title, these values will take precedence over the default values.|
| `discussion_to_resolve`                   | string         | no       | The ID of a discussion to resolve. This will fill in the issue with a default description and mark the discussion as resolved. Use in combination with `merge_request_to_resolve_discussions_of`. |
| `weight` | integer                                         | no | The weight of the issue in range 0 to 9 |
397 398

```bash
399
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/4/issues?title=Issues%20with%20auth&labels=bug
400
```
Nihad Abbasov's avatar
Nihad Abbasov committed
401

402
Example response:
Nihad Abbasov's avatar
Nihad Abbasov committed
403

404 405 406 407 408 409 410 411
```json
{
   "project_id" : 4,
   "id" : 84,
   "created_at" : "2016-01-07T12:44:33.959Z",
   "iid" : 14,
   "title" : "Issues with auth",
   "state" : "opened",
412
   "assignees" : [],
413
   "assignee" : null,
414 415 416 417 418 419 420
   "labels" : [
      "bug"
   ],
   "author" : {
      "name" : "Alexandra Bashirian",
      "avatar_url" : null,
      "state" : "active",
421
      "web_url" : "https://gitlab.example.com/eileen.lowe",
422 423 424 425 426
      "id" : 18,
      "username" : "eileen.lowe"
   },
   "description" : null,
   "updated_at" : "2016-01-07T12:44:33.959Z",
427
   "milestone" : null,
428
   "subscribed" : true,
429
   "user_notes_count": 0,
430
   "due_date": null,
431
   "web_url": "http://example.com/example/example/issues/14",
432
   "confidential": false,
Lin Jen-Shin's avatar
Lin Jen-Shin committed
433
   "weight": null,
434 435 436 437 438 439
   "_links": {
      "self": "http://example.com/api/v4/projects/1/issues/2",
      "notes": "http://example.com/api/v4/projects/1/issues/2/notes",
      "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
      "project": "http://example.com/api/v4/projects/1"
   }
440 441
}
```
442

443
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
444

Nihad Abbasov's avatar
Nihad Abbasov committed
445 446
## Edit issue

447 448 449
Updates an existing project issue. This call is also used to mark an issue as
closed.

Nihad Abbasov's avatar
Nihad Abbasov committed
450
```
451
PUT /projects/:id/issues/:issue_iid
Nihad Abbasov's avatar
Nihad Abbasov committed
452 453
```

454
| Attribute      | Type    | Required | Description                                                                                                |
455
|----------------|---------|----------|------------------------------------------------------------------------------------------------------------|
456
| `id`           | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
457 458 459 460
| `issue_iid`    | integer | yes      | The internal ID of a project's issue                                                                       |
| `title`        | string  | no       | The title of an issue                                                                                      |
| `description`  | string  | no       | The description of an issue                                                                                |
| `confidential` | boolean | no       | Updates an issue to be confidential                                                                        |
461
| `assignee_ids`  | Array[integer] | no       | The ID of the users to assign the issue to                                                                    |
462 463 464 465 466
| `milestone_id` | integer | no       | The ID of a milestone to assign the issue to                                                               |
| `labels`       | string  | no       | Comma-separated label names for an issue                                                                   |
| `state_event`  | string  | no       | The state event of an issue. Set `close` to close the issue and `reopen` to reopen it                      |
| `updated_at`   | string  | no       | Date time string, ISO 8601 formatted, e.g. `2016-03-11T03:45:40Z` (requires admin or project owner rights) |
| `due_date`     | string  | no       | Date time string in the format YEAR-MONTH-DAY, e.g. `2016-03-11`                                           |
Nick Thomas's avatar
Nick Thomas committed
467
| `weight`       | integer | no       | The weight of the issue in range 0 to 9                                                                    |
468 469

```bash
470
curl --request PUT --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/4/issues/85?state_event=close
471
```
Nihad Abbasov's avatar
Nihad Abbasov committed
472

473
Example response:
474

475 476 477 478 479 480 481 482 483
```json
{
   "created_at" : "2016-01-07T12:46:01.410Z",
   "author" : {
      "name" : "Alexandra Bashirian",
      "avatar_url" : null,
      "username" : "eileen.lowe",
      "id" : 18,
      "state" : "active",
484
      "web_url" : "https://gitlab.example.com/eileen.lowe"
485 486 487 488 489 490 491 492 493 494 495
   },
   "state" : "closed",
   "title" : "Issues with auth",
   "project_id" : 4,
   "description" : null,
   "updated_at" : "2016-01-07T12:55:16.213Z",
   "iid" : 15,
   "labels" : [
      "bug"
   ],
   "id" : 85,
496
   "assignees" : [],
497
   "assignee" : null,
498
   "milestone" : null,
499
   "subscribed" : true,
500
   "user_notes_count": 0,
501
   "due_date": "2016-07-22",
502
   "web_url": "http://example.com/example/example/issues/15",
503
   "confidential": false,
Lin Jen-Shin's avatar
Lin Jen-Shin committed
504
   "weight": null,
505 506 507 508 509 510
   "_links": {
      "self": "http://example.com/api/v4/projects/1/issues/2",
      "notes": "http://example.com/api/v4/projects/1/issues/2/notes",
      "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
      "project": "http://example.com/api/v4/projects/1"
   }
511 512
}
```
513

514
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
515

516
## Delete an issue
517

518
Only for admins and project owners. Soft deletes the issue in question.
519 520

```
521
DELETE /projects/:id/issues/:issue_iid
522 523
```

524
| Attribute   | Type    | Required | Description                          |
525
|-------------|---------|----------|--------------------------------------|
526
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
527
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
528 529

```bash
530
curl --request DELETE --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/4/issues/85
531 532
```

533 534
## Move an issue

535
Moves an issue to a different project. If the target project
536 537
equals the source project or the user has insufficient permissions to move an
issue, error `400` together with an explaining error message is returned.
538

539 540 541
If a given label and/or milestone with the same name also exists in the target
project, it will then be assigned to the issue that is being moved.

542
```
543
POST /projects/:id/issues/:issue_iid/move
544 545
```

546
| Attribute       | Type    | Required | Description                          |
547
|-----------------|---------|----------|--------------------------------------|
548
| `id`            | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
549 550
| `issue_iid`     | integer | yes      | The internal ID of a project's issue |
| `to_project_id` | integer | yes      | The ID of the new project            |
551 552

```bash
553
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/4/issues/85/move
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
```

Example response:

```json
{
  "id": 92,
  "iid": 11,
  "project_id": 5,
  "title": "Sit voluptas tempora quisquam aut doloribus et.",
  "description": "Repellat voluptas quibusdam voluptatem exercitationem.",
  "state": "opened",
  "created_at": "2016-04-05T21:41:45.652Z",
  "updated_at": "2016-04-07T12:20:17.596Z",
  "labels": [],
  "milestone": null,
570
  "assignees": [{
571 572 573 574 575
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
576
    "web_url": "https://gitlab.example.com/axel.block"
577
  }],
578 579 580 581 582 583 584 585
  "assignee": {
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/axel.block"
  },
586 587 588 589 590 591
  "author": {
    "name": "Kris Steuber",
    "username": "solon.cremin",
    "id": 10,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon",
592
    "web_url": "https://gitlab.example.com/solon.cremin"
593
  },
594
  "due_date": null,
595
  "web_url": "http://example.com/example/example/issues/11",
596
  "confidential": false,
Lin Jen-Shin's avatar
Lin Jen-Shin committed
597
  "weight": null,
598 599 600 601 602 603
  "_links": {
    "self": "http://example.com/api/v4/projects/1/issues/2",
    "notes": "http://example.com/api/v4/projects/1/issues/2/notes",
    "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
    "project": "http://example.com/api/v4/projects/1"
  }
604 605 606
}
```

607
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
608

609 610
## Subscribe to an issue

611
Subscribes the authenticated user to an issue to receive notifications.
612 613
If the user is already subscribed to the issue, the status code `304`
is returned.
614 615

```
616
POST /projects/:id/issues/:issue_iid/subscribe
617 618
```

619
| Attribute   | Type    | Required | Description                          |
620
|-------------|---------|----------|--------------------------------------|
621
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
622
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
623 624

```bash
625
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/5/issues/93/subscribe
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641
```

Example response:

```json
{
  "id": 92,
  "iid": 11,
  "project_id": 5,
  "title": "Sit voluptas tempora quisquam aut doloribus et.",
  "description": "Repellat voluptas quibusdam voluptatem exercitationem.",
  "state": "opened",
  "created_at": "2016-04-05T21:41:45.652Z",
  "updated_at": "2016-04-07T12:20:17.596Z",
  "labels": [],
  "milestone": null,
642
  "assignees": [{
643 644 645 646 647
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
648
    "web_url": "https://gitlab.example.com/axel.block"
649
  }],
650 651 652 653 654 655 656 657
  "assignee": {
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/axel.block"
  },
658 659 660 661 662 663
  "author": {
    "name": "Kris Steuber",
    "username": "solon.cremin",
    "id": 10,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon",
664
    "web_url": "https://gitlab.example.com/solon.cremin"
665
  },
666
  "due_date": null,
667
  "web_url": "http://example.com/example/example/issues/11",
668
  "confidential": false,
Lin Jen-Shin's avatar
Lin Jen-Shin committed
669
  "weight": null,
670 671 672 673 674 675
  "_links": {
    "self": "http://example.com/api/v4/projects/1/issues/2",
    "notes": "http://example.com/api/v4/projects/1/issues/2/notes",
    "award_emoji": "http://example.com/api/v4/projects/1/issues/2/award_emoji",
    "project": "http://example.com/api/v4/projects/1"
  }
676 677 678
}
```

679
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
680

681 682
## Unsubscribe from an issue

683
Unsubscribes the authenticated user from the issue to not receive notifications
684 685
from it. If the user is not subscribed to the issue, the
status code `304` is returned.
686 687

```
688
POST /projects/:id/issues/:issue_iid/unsubscribe
689 690
```

691
| Attribute   | Type    | Required | Description                          |
692
|-------------|---------|----------|--------------------------------------|
693
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
694
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
695 696

```bash
697
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/5/issues/93/unsubscribe
698 699
```

700 701
## Create a todo

702
Manually creates a todo for the current user on an issue. If
703 704 705 706
there already exists a todo for the user on that issue, status code `304` is
returned.

```
707
POST /projects/:id/issues/:issue_iid/todo
708 709
```

710
| Attribute   | Type    | Required | Description                          |
711
|-------------|---------|----------|--------------------------------------|
712
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
713
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
714 715

```bash
716
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/5/issues/93/todo
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736
```

Example response:

```json
{
  "id": 112,
  "project": {
    "id": 5,
    "name": "Gitlab Ci",
    "name_with_namespace": "Gitlab Org / Gitlab Ci",
    "path": "gitlab-ci",
    "path_with_namespace": "gitlab-org/gitlab-ci"
  },
  "author": {
    "name": "Administrator",
    "username": "root",
    "id": 1,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
737
    "web_url": "https://gitlab.example.com/root"
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761
  },
  "action_name": "marked",
  "target_type": "Issue",
  "target": {
    "id": 93,
    "iid": 10,
    "project_id": 5,
    "title": "Vel voluptas atque dicta mollitia adipisci qui at.",
    "description": "Tempora laboriosam sint magni sed voluptas similique.",
    "state": "closed",
    "created_at": "2016-06-17T07:47:39.486Z",
    "updated_at": "2016-07-01T11:09:13.998Z",
    "labels": [],
    "milestone": {
      "id": 26,
      "iid": 1,
      "project_id": 5,
      "title": "v0.0",
      "description": "Accusantium nostrum rerum quae quia quis nesciunt suscipit id.",
      "state": "closed",
      "created_at": "2016-06-17T07:47:33.832Z",
      "updated_at": "2016-06-17T07:47:33.832Z",
      "due_date": null
    },
762
    "assignees": [{
763 764 765 766 767
      "name": "Jarret O'Keefe",
      "username": "francisca",
      "id": 14,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
768
      "web_url": "https://gitlab.example.com/francisca"
769
    }],
770 771 772 773 774 775 776 777
    "assignee": {
      "name": "Jarret O'Keefe",
      "username": "francisca",
      "id": 14,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
      "web_url": "https://gitlab.example.com/francisca"
    },
778 779 780 781 782 783
    "author": {
      "name": "Maxie Medhurst",
      "username": "craig_rutherford",
      "id": 12,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
784
      "web_url": "https://gitlab.example.com/craig_rutherford"
785 786 787 788
    },
    "subscribed": true,
    "user_notes_count": 7,
    "upvotes": 0,
789 790
    "downvotes": 0,
    "due_date": null,
791
    "web_url": "http://example.com/example/example/issues/110",
792 793
    "confidential": false,
    "weight": null
794 795 796 797 798 799 800 801
  },
  "target_url": "https://gitlab.example.com/gitlab-org/gitlab-ci/issues/10",
  "body": "Vel voluptas atque dicta mollitia adipisci qui at.",
  "state": "pending",
  "created_at": "2016-07-01T11:09:13.992Z"
}
```

802
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
803

804 805 806 807 808
## Set a time estimate for an issue

Sets an estimated time of work for this issue.

```
809
POST /projects/:id/issues/:issue_iid/time_estimate
810 811
```

812
| Attribute   | Type    | Required | Description                              |
813
|-------------|---------|----------|------------------------------------------|
814
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
815 816
| `issue_iid` | integer | yes      | The internal ID of a project's issue     |
| `duration`  | string  | yes      | The duration in human format. e.g: 3h30m |
817 818

```bash
819
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/5/issues/93/time_estimate?duration=3h30m
820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837
```

Example response:

```json
{
  "human_time_estimate": "3h 30m",
  "human_total_time_spent": null,
  "time_estimate": 12600,
  "total_time_spent": 0
}
```

## Reset the time estimate for an issue

Resets the estimated time for this issue to 0 seconds.

```
838
POST /projects/:id/issues/:issue_iid/reset_time_estimate
839 840
```

841
| Attribute   | Type    | Required | Description                          |
842
|-------------|---------|----------|--------------------------------------|
843
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
844
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
845 846

```bash
847
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/5/issues/93/reset_time_estimate
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865
```

Example response:

```json
{
  "human_time_estimate": null,
  "human_total_time_spent": null,
  "time_estimate": 0,
  "total_time_spent": 0
}
```

## Add spent time for an issue

Adds spent time for this issue

```
866
POST /projects/:id/issues/:issue_iid/add_spent_time
867 868
```

869
| Attribute   | Type    | Required | Description                              |
870
|-------------|---------|----------|------------------------------------------|
871
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
872 873
| `issue_iid` | integer | yes      | The internal ID of a project's issue     |
| `duration`  | string  | yes      | The duration in human format. e.g: 3h30m |
874 875

```bash
876
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/5/issues/93/add_spent_time?duration=1h
877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894
```

Example response:

```json
{
  "human_time_estimate": null,
  "human_total_time_spent": "1h",
  "time_estimate": 0,
  "total_time_spent": 3600
}
```

## Reset spent time for an issue

Resets the total spent time for this issue to 0 seconds.

```
895
POST /projects/:id/issues/:issue_iid/reset_spent_time
896 897
```

898
| Attribute   | Type    | Required | Description                          |
899
|-------------|---------|----------|--------------------------------------|
900
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
901
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
902 903

```bash
904
curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/5/issues/93/reset_spent_time
905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920
```

Example response:

```json
{
  "human_time_estimate": null,
  "human_total_time_spent": null,
  "time_estimate": 0,
  "total_time_spent": 0
}
```

## Get time tracking stats

```
921
GET /projects/:id/issues/:issue_iid/time_stats
922 923
```

924
| Attribute   | Type    | Required | Description                          |
925
|-------------|---------|----------|--------------------------------------|
926
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
927
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
928 929

```bash
930
curl --request GET --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/5/issues/93/time_stats
931 932 933 934 935 936 937 938 939 940 941 942 943
```

Example response:

```json
{
  "human_time_estimate": "2h",
  "human_total_time_spent": "1h",
  "time_estimate": 7200,
  "total_time_spent": 3600
}
```

944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004
## List merge requests that will close issue on merge

Get all the merge requests that will close issue when merged.

```
GET /projects/:id/issues/:issue_iid/closed_by
```

| Attribute   | Type    | Required | Description                          |
| ---------   | ----    | -------- | -----------                          |
| `id`        | integer | yes      | The ID of a project                  |
| `issue_iid` | integer | yes      | The internal ID of a project issue   |

```bash
curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/1/issues/11/closed_by
```

Example response:

```json
[
  {
    "id": 6471,
    "iid": 6432,
    "project_id": 1,
    "title": "add a test for cgi lexer options",
    "description": "closes #11",
    "state": "opened",
    "created_at": "2017-04-06T18:33:34.168Z",
    "updated_at": "2017-04-09T20:10:24.983Z",
    "target_branch": "master",
    "source_branch": "feature.custom-highlighting",
    "upvotes": 0,
    "downvotes": 0,
    "author": {
      "name": "Administrator",
      "username": "root",
      "id": 1,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80&d=identicon",
      "web_url": "https://gitlab.example.com/root"
    },
    "assignee": null,
    "source_project_id": 1,
    "target_project_id": 1,
    "labels": [],
    "work_in_progress": false,
    "milestone": null,
    "merge_when_pipeline_succeeds": false,
    "merge_status": "unchecked",
    "sha": "5a62481d563af92b8e32d735f2fa63b94e806835",
    "merge_commit_sha": null,
    "user_notes_count": 1,
    "should_remove_source_branch": null,
    "force_remove_source_branch": false,
    "web_url": "https://gitlab.example.com/gitlab-org/gitlab-test/merge_requests/6432"
  }
]
```


1005 1006
## Comments on issues

1007
Comments are done via the [notes](notes.md) resource.
James Lopez's avatar
James Lopez committed
1008 1009 1010

## Get user agent details

James Lopez's avatar
James Lopez committed
1011 1012
Available only for admins.

James Lopez's avatar
James Lopez committed
1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031
```
GET /projects/:id/issues/:issue_iid/user_agent_detail
```

| 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 |

```bash
curl --request GET --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v4/projects/5/issues/93/user_agent_detail
```

Example response:

```json
{
  "user_agent": "AppleWebKit/537.36",
  "ip_address": "127.0.0.1",
1032
  "akismet_submitted": false
James Lopez's avatar
James Lopez committed
1033 1034
}
```