issues.md 57.3 KB
Newer Older
1
# Issues API
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 18 19
Get all issues the authenticated user has access to. By default it
returns only issues created by the current user. To get all issues,
use parameter `scope=all`.
Nihad Abbasov's avatar
Nihad Abbasov committed
20 21 22

```
GET /issues
23 24
GET /issues?state=opened
GET /issues?state=closed
25 26 27
GET /issues?labels=foo
GET /issues?labels=foo,bar
GET /issues?labels=foo,bar&state=opened
28 29
GET /issues?milestone=1.0.0
GET /issues?milestone=1.0.0&state=opened
30
GET /issues?iids[]=42&iids[]=43
31 32
GET /issues?author_id=5
GET /issues?assignee_id=5
33
GET /issues?my_reaction_emoji=star
34
GET /issues?search=foo&in=title
Nihad Abbasov's avatar
Nihad Abbasov committed
35 36
```

37 38 39
| Attribute           | Type             | Required   | Description                                                                                                                                         |
| ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `state`             | string           | no         | Return all issues or just those that are `opened` or `closed`                                                                                       |
40
| `labels`            | string           | no         | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
41
| `milestone`         | string           | no         | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone.                             |
42 43
| `scope`             | string           | no         | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`. Defaults to `created_by_me`<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced][ce-13004] in GitLab 9.5. [Changed to snake_case][ce-18935] in GitLab 11.0)_ |
| `author_id`         | integer          | no         | Return issues created by the given user `id`. Combine with `scope=all` or `scope=assigned_to_me`. _([Introduced][ce-13004] in GitLab 9.5)_          |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
44
| `assignee_id`       | integer          | no         | Return issues assigned to the given user `id`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
45
| `my_reaction_emoji` | string           | no         | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced][ce-14016] in GitLab 10.0)_ |
46 47 48 49
| `iids[]`            | Array[integer]   | no         | Return only the issues having the given `iid`                                                                                                       |
| `order_by`          | string           | no         | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at`                                                               |
| `sort`              | string           | no         | Return issues sorted in `asc` or `desc` order. Default is `desc`                                                                                    |
| `search`            | string           | no         | Search issues against their `title` and `description`                                                                                               |
Hiroyuki Sato's avatar
Hiroyuki Sato committed
50
| `in`                | string           | no         | Modify the scope of the `search` attribute. `title`, `description`, or a string joining them with comma. Default is `title,description`              |
51 52 53 54
| `created_after`     | datetime         | no         | Return issues created on or after the given time                                                                                                    |
| `created_before`    | datetime         | no         | Return issues created on or before the given time                                                                                                   |
| `updated_after`     | datetime         | no         | Return issues updated on or after the given time                                                                                                    |
| `updated_before`    | datetime         | no         | Return issues updated on or before the given time                                                                                                   |
55 56

```bash
57
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/issues
58
```
59

60
Example response:
61

Nihad Abbasov's avatar
Nihad Abbasov committed
62 63
```json
[
64 65 66 67 68 69
   {
      "state" : "opened",
      "description" : "Ratione dolores corrupti mollitia soluta quia.",
      "author" : {
         "state" : "active",
         "id" : 18,
70
         "web_url" : "https://gitlab.example.com/eileen.lowe",
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
         "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,
87 88 89 90 91 92 93 94
      "assignees" : [{
         "state" : "active",
         "id" : 1,
         "name" : "Administrator",
         "web_url" : "https://gitlab.example.com/root",
         "avatar_url" : null,
         "username" : "root"
      }],
95 96 97 98
      "assignee" : {
         "state" : "active",
         "id" : 1,
         "name" : "Administrator",
99
         "web_url" : "https://gitlab.example.com/root",
100 101 102 103
         "avatar_url" : null,
         "username" : "root"
      },
      "updated_at" : "2016-01-04T15:31:51.081Z",
104
      "closed_at" : null,
haseeb's avatar
haseeb committed
105
      "closed_by" : null,
106 107 108 109
      "id" : 76,
      "title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
      "created_at" : "2016-01-04T15:31:51.081Z",
      "iid" : 6,
110
      "labels" : [],
111 112
      "upvotes": 4,
      "downvotes": 0,
113
      "merge_requests_count": 0,
114
      "user_notes_count": 1,
115
      "due_date": "2016-07-22",
116
      "web_url": "http://example.com/example/example/issues/6",
117 118 119 120 121 122
      "time_stats": {
         "time_estimate": 0,
         "total_time_spent": 0,
         "human_time_estimate": null,
         "human_total_time_spent": null
      },
123 124
      "confidential": false,
      "discussion_locked": false
125
   }
Nihad Abbasov's avatar
Nihad Abbasov committed
126 127 128
]
```

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

haseeb's avatar
haseeb committed
131 132
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

133 134 135 136 137 138 139 140 141 142 143 144 145
## 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
146
GET /groups/:id/issues?iids[]=42&iids[]=43
147
GET /groups/:id/issues?search=issue+title+or+description
148 149
GET /groups/:id/issues?author_id=5
GET /groups/:id/issues?assignee_id=5
150
GET /groups/:id/issues?my_reaction_emoji=star
151 152
```

153 154 155 156
| Attribute           | Type             | Required   | Description                                                                                                                   |
| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `id`                | integer/string   | yes        | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user                 |
| `state`             | string           | no         | Return all issues or just those that are `opened` or `closed`                                                                 |
157
| `labels`            | string           | no         | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
158
| `iids[]`            | Array[integer]   | no         | Return only the issues having the given `iid`                                                                                 |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
159
| `milestone`         | string           | no         | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone.       |
160
| `scope`             | string           | no         | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`.<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced][ce-13004] in GitLab 9.5. [Changed to snake_case][ce-18935] in GitLab 11.0)_ |
161
| `author_id`         | integer          | no         | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_                                         |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
162
| `assignee_id`       | integer          | no         | Return issues assigned to the given user `id`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
163
| `my_reaction_emoji` | string           | no         | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced][ce-14016] in GitLab 10.0)_ |
164 165 166
| `order_by`          | string           | no         | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at`                                         |
| `sort`              | string           | no         | Return issues sorted in `asc` or `desc` order. Default is `desc`                                                              |
| `search`            | string           | no         | Search group issues against their `title` and `description`                                                                   |
167 168 169 170
| `created_after`     | datetime         | no         | Return issues created on or after the given time                                                                              |
| `created_before`    | datetime         | no         | Return issues created on or before the given time                                                                             |
| `updated_after`     | datetime         | no         | Return issues updated on or after the given time                                                                              |
| `updated_before`    | datetime         | no         | Return issues updated on or before the given time                                                                             |
171 172

```bash
173
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/groups/4/issues
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
```

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",
195
         "web_url" : "https://gitlab.example.com/root",
196 197 198 199 200 201 202 203
         "avatar_url" : null,
         "username" : "root",
         "id" : 1,
         "name" : "Administrator"
      },
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "state" : "closed",
      "iid" : 1,
204 205 206 207 208 209 210 211
      "assignees" : [{
         "avatar_url" : null,
         "web_url" : "https://gitlab.example.com/lennie",
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
      }],
212 213
      "assignee" : {
         "avatar_url" : null,
214
         "web_url" : "https://gitlab.example.com/lennie",
215 216 217 218 219 220
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
      },
      "labels" : [],
221 222
      "upvotes": 4,
      "downvotes": 0,
223
      "merge_requests_count": 0,
224 225 226 227
      "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",
228
      "closed_at" : null,
haseeb's avatar
haseeb committed
229
      "closed_by" : null,
230
      "user_notes_count": 1,
231
      "due_date": null,
232
      "web_url": "http://example.com/example/example/issues/1",
233 234 235 236 237 238
      "time_stats": {
         "time_estimate": 0,
         "total_time_spent": 0,
         "human_time_estimate": null,
         "human_total_time_spent": null
      },
239 240
      "confidential": false,
      "discussion_locked": false
241 242 243 244
   }
]
```

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

haseeb's avatar
haseeb committed
247 248
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

Nihad Abbasov's avatar
Nihad Abbasov committed
249 250
## List project issues

251
Get a list of a project's issues.
Nihad Abbasov's avatar
Nihad Abbasov committed
252 253 254

```
GET /projects/:id/issues
255 256
GET /projects/:id/issues?state=opened
GET /projects/:id/issues?state=closed
257 258 259
GET /projects/:id/issues?labels=foo
GET /projects/:id/issues?labels=foo,bar
GET /projects/:id/issues?labels=foo,bar&state=opened
260 261
GET /projects/:id/issues?milestone=1.0.0
GET /projects/:id/issues?milestone=1.0.0&state=opened
262
GET /projects/:id/issues?iids[]=42&iids[]=43
263
GET /projects/:id/issues?search=issue+title+or+description
264 265
GET /projects/:id/issues?author_id=5
GET /projects/:id/issues?assignee_id=5
266
GET /projects/:id/issues?my_reaction_emoji=star
Nihad Abbasov's avatar
Nihad Abbasov committed
267 268
```

269 270 271 272 273
| 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               |
| `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`                                                                 |
274
| `labels`            | string           | no         | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
275
| `milestone`         | string           | no         | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone.       |
276
| `scope`             | string           | no         | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`.<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced][ce-13004] in GitLab 9.5. [Changed to snake_case][ce-18935] in GitLab 11.0)_ |
277
| `author_id`         | integer          | no         | Return issues created by the given user `id` _([Introduced][ce-13004] in GitLab 9.5)_                                         |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
278
| `assignee_id`       | integer          | no         | Return issues assigned to the given user `id`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced][ce-13004] in GitLab 9.5)_ |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
279
| `my_reaction_emoji` | string           | no         | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced][ce-14016] in GitLab 10.0)_ |
280 281 282
| `order_by`          | string           | no         | Return issues ordered by `created_at` or `updated_at` fields. Default is `created_at`                                         |
| `sort`              | string           | no         | Return issues sorted in `asc` or `desc` order. Default is `desc`                                                              |
| `search`            | string           | no         | Search project issues against their `title` and `description`                                                                 |
283 284 285 286
| `created_after`     | datetime         | no         | Return issues created on or after the given time                                                                              |
| `created_before`    | datetime         | no         | Return issues created on or before the given time                                                                             |
| `updated_after`     | datetime         | no         | Return issues updated on or after the given time                                                                              |
| `updated_before`    | datetime         | no         | Return issues updated on or before the given time                                                                             |
287 288

```bash
289
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues
290 291 292
```

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

294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
```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",
311
         "web_url" : "https://gitlab.example.com/root",
312 313 314 315 316 317 318 319
         "avatar_url" : null,
         "username" : "root",
         "id" : 1,
         "name" : "Administrator"
      },
      "description" : "Omnis vero earum sunt corporis dolor et placeat.",
      "state" : "closed",
      "iid" : 1,
320 321 322 323 324 325 326 327
      "assignees" : [{
         "avatar_url" : null,
         "web_url" : "https://gitlab.example.com/lennie",
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
      }],
328 329
      "assignee" : {
         "avatar_url" : null,
330
         "web_url" : "https://gitlab.example.com/lennie",
331 332 333 334 335 336
         "state" : "active",
         "username" : "lennie",
         "id" : 9,
         "name" : "Dr. Luella Kovacek"
      },
      "labels" : [],
337 338
      "upvotes": 4,
      "downvotes": 0,
339
      "merge_requests_count": 0,
340 341 342
      "id" : 41,
      "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
      "updated_at" : "2016-01-04T15:31:46.176Z",
343
      "created_at" : "2016-01-04T15:31:46.176Z",
344
      "closed_at" : "2016-01-05T15:31:46.176Z",
haseeb's avatar
haseeb committed
345 346 347 348 349 350 351 352
      "closed_by" : {
         "state" : "active",
         "web_url" : "https://gitlab.example.com/root",
         "avatar_url" : null,
         "username" : "root",
         "id" : 1,
         "name" : "Administrator"
      },
353
      "user_notes_count": 1,
354
      "due_date": "2016-07-22",
355
      "web_url": "http://example.com/example/example/issues/1",
356 357 358 359 360 361
      "time_stats": {
         "time_estimate": 0,
         "total_time_spent": 0,
         "human_time_estimate": null,
         "human_total_time_spent": null
      },
362 363
      "confidential": false,
      "discussion_locked": false
364 365 366
   }
]
```
367

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

haseeb's avatar
haseeb committed
370 371
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

Nihad Abbasov's avatar
Nihad Abbasov committed
372 373
## Single issue

374
Get a single project issue.
Nihad Abbasov's avatar
Nihad Abbasov committed
375 376

```
377
GET /projects/:id/issues/:issue_iid
Nihad Abbasov's avatar
Nihad Abbasov committed
378 379
```

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

385
```bash
386
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues/41
387 388 389
```

Example response:
Nihad Abbasov's avatar
Nihad Abbasov committed
390 391 392

```json
{
393 394 395 396 397 398 399 400 401 402
   "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",
403 404
      "updated_at" : "2016-01-04T15:31:39.788Z",
      "closed_at" : "2016-01-05T15:31:46.176Z"
405 406 407
   },
   "author" : {
      "state" : "active",
408
      "web_url" : "https://gitlab.example.com/root",
409 410 411 412 413 414 415 416
      "avatar_url" : null,
      "username" : "root",
      "id" : 1,
      "name" : "Administrator"
   },
   "description" : "Omnis vero earum sunt corporis dolor et placeat.",
   "state" : "closed",
   "iid" : 1,
417 418 419 420 421 422 423 424
   "assignees" : [{
      "avatar_url" : null,
      "web_url" : "https://gitlab.example.com/lennie",
      "state" : "active",
      "username" : "lennie",
      "id" : 9,
      "name" : "Dr. Luella Kovacek"
   }],
425 426
   "assignee" : {
      "avatar_url" : null,
427
      "web_url" : "https://gitlab.example.com/lennie",
428 429 430 431 432 433
      "state" : "active",
      "username" : "lennie",
      "id" : 9,
      "name" : "Dr. Luella Kovacek"
   },
   "labels" : [],
434 435
   "upvotes": 4,
   "downvotes": 0,
436
   "merge_requests_count": 0,
437 438 439
   "id" : 41,
   "title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
   "updated_at" : "2016-01-04T15:31:46.176Z",
440
   "created_at" : "2016-01-04T15:31:46.176Z",
haseeb's avatar
haseeb committed
441 442
   "closed_at" : null,
   "closed_by" : null,
443
   "subscribed": false,
444
   "user_notes_count": 1,
445
   "due_date": null,
446
   "web_url": "http://example.com/example/example/issues/1",
447 448 449 450 451 452
   "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
   },
453
   "confidential": false,
454
   "discussion_locked": false,
455 456 457 458 459 460
   "_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
461 462 463
}
```

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

haseeb's avatar
haseeb committed
466 467
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

Nihad Abbasov's avatar
Nihad Abbasov committed
468 469
## New issue

470
Creates a new project issue.
Nihad Abbasov's avatar
Nihad Abbasov committed
471 472 473 474 475

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

476 477
| Attribute                                 | Type           | Required | Description  |
|-------------------------------------------|----------------|----------|--------------|
478
| `id`                                      | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
479
| `iid`                                     | integer/string | no       | The internal ID of the project's issue (requires admin or project owner rights) |
480 481 482
| `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`.  |
483
| `assignee_ids`                            | Array[integer] | no       | The ID of the users to assign issue |
484
| `milestone_id`                            | integer | no       | The global ID of a milestone to assign issue  |
485
| `labels`                                  | string  | no       | Comma-separated label names for an issue  |
486
| `created_at`                              | string  | no       | Date time string, ISO 8601 formatted, e.g. `2016-03-11T03:45:40Z` (requires admin or project/group owner rights) |
487 488 489
| `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`. |
490 491

```bash
492
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues?title=Issues%20with%20auth&labels=bug
493
```
Nihad Abbasov's avatar
Nihad Abbasov committed
494

495
Example response:
Nihad Abbasov's avatar
Nihad Abbasov committed
496

497 498 499 500 501 502 503 504
```json
{
   "project_id" : 4,
   "id" : 84,
   "created_at" : "2016-01-07T12:44:33.959Z",
   "iid" : 14,
   "title" : "Issues with auth",
   "state" : "opened",
505
   "assignees" : [],
506 507 508 509
   "assignee" : null,
   "labels" : [
      "bug"
   ],
510 511
   "upvotes": 4,
   "downvotes": 0,
512
   "merge_requests_count": 0,
513 514 515 516
   "author" : {
      "name" : "Alexandra Bashirian",
      "avatar_url" : null,
      "state" : "active",
517
      "web_url" : "https://gitlab.example.com/eileen.lowe",
518 519 520 521 522
      "id" : 18,
      "username" : "eileen.lowe"
   },
   "description" : null,
   "updated_at" : "2016-01-07T12:44:33.959Z",
523
   "closed_at" : null,
haseeb's avatar
haseeb committed
524
   "closed_by" : null,
525
   "milestone" : null,
526
   "subscribed" : true,
527
   "user_notes_count": 0,
528
   "due_date": null,
529
   "web_url": "http://example.com/example/example/issues/14",
530 531 532 533 534 535
   "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
   },
536
   "confidential": false,
537
   "discussion_locked": false,
538 539 540 541 542 543
   "_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"
   }
544 545
}
```
546

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

haseeb's avatar
haseeb committed
549 550
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

Nihad Abbasov's avatar
Nihad Abbasov committed
551 552
## Edit issue

553 554 555
Updates an existing project issue. This call is also used to mark an issue as
closed.

Nihad Abbasov's avatar
Nihad Abbasov committed
556
```
557
PUT /projects/:id/issues/:issue_iid
Nihad Abbasov's avatar
Nihad Abbasov committed
558 559
```

560
| Attribute      | Type    | Required | Description                                                                                                |
561
|----------------|---------|----------|------------------------------------------------------------------------------------------------------------|
562
| `id`           | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
563 564 565 566
| `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                                                                        |
567
| `assignee_ids`  | Array[integer] | no  | The ID of the user(s) to assign the issue to. Set to `0` or provide an empty value to unassign all assignees.  |
568
| `milestone_id` | integer | no       | The global ID of a milestone to assign the issue to. Set to `0` or provide an empty value to unassign a milestone.|
569
| `labels`       | string  | no       | Comma-separated label names for an issue. Set to an empty string to unassign all labels.                   |
570 571 572
| `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`                                           |
573
| `discussion_locked` | boolean | no  | Flag indicating if the issue's discussion is locked. If the discussion is locked only project members can add or edit comments. |
574

575
```bash
576
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues/85?state_event=close
577
```
Nihad Abbasov's avatar
Nihad Abbasov committed
578

579
Example response:
580

581 582 583 584 585 586 587 588 589
```json
{
   "created_at" : "2016-01-07T12:46:01.410Z",
   "author" : {
      "name" : "Alexandra Bashirian",
      "avatar_url" : null,
      "username" : "eileen.lowe",
      "id" : 18,
      "state" : "active",
590
      "web_url" : "https://gitlab.example.com/eileen.lowe"
591 592 593 594 595 596
   },
   "state" : "closed",
   "title" : "Issues with auth",
   "project_id" : 4,
   "description" : null,
   "updated_at" : "2016-01-07T12:55:16.213Z",
597
   "closed_at" : "2016-01-08T12:55:16.213Z",
haseeb's avatar
haseeb committed
598 599 600 601 602 603 604 605
   "closed_by" : {
      "state" : "active",
      "web_url" : "https://gitlab.example.com/root",
      "avatar_url" : null,
      "username" : "root",
      "id" : 1,
      "name" : "Administrator"
    },
606 607 608 609
   "iid" : 15,
   "labels" : [
      "bug"
   ],
610 611
   "upvotes": 4,
   "downvotes": 0,
612
   "merge_requests_count": 0,
613
   "id" : 85,
614
   "assignees" : [],
615
   "assignee" : null,
616
   "milestone" : null,
617
   "subscribed" : true,
618
   "user_notes_count": 0,
619
   "due_date": "2016-07-22",
620
   "web_url": "http://example.com/example/example/issues/15",
621 622 623 624 625 626
   "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
   },
627
   "confidential": false,
628
   "discussion_locked": false,
629 630 631 632 633 634
   "_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"
   }
635 636
}
```
637

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

haseeb's avatar
haseeb committed
640 641
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

642 643
## Bulk update issues

644
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21368) in GitLab 11.9.
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672

Update multiple issues using a single API call. Returns the number of successfully updated issues.

```
PUT /projects/:id/issues/bulk_update
```

| 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. |
| `issuable_ids`  | Array[integer] | yes     | The IDs of issues to be updated.                                                                       |
| `assignee_ids`  | Array[integer] | no      | The ID of the user(s) to assign the issue to. Set to `0` or provide an empty value to unassign all assignees.  |
| `milestone_id`  | integer        | no      | The global ID of a milestone to assign the issue to. Set to `0` or provide an empty value to unassign a milestone.|
| `add_label_ids`      | Array[integer] | no | Comma-separated label IDs to be added. |
| `remove_label_ids`   | Array[integer] | no | Comma-separated label IDs to be added. |
| `state_event`        | string  | no  | The state event of an issue. Set `close` to close the issue and `reopen` to reopen it.                      |
| `subscription_event` | string  | no  | The subscription_event event of an issue. Set `subscribe` to subscribe to the issue and `unsubscribe` to unsubscribe from it. |

```bash
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues/bulk_update?issuable_ids[]=1&issuable_ids[]=2&state_event=close
```

Example response:

```json
{ "message": "2 issues updated" }
```

673
## Delete an issue
674

675
Only for admins and project owners. Soft deletes the issue in question.
676 677

```
678
DELETE /projects/:id/issues/:issue_iid
679 680
```

681
| Attribute   | Type    | Required | Description                          |
682
|-------------|---------|----------|--------------------------------------|
683
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
684
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
685 686

```bash
687
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues/85
688 689
```

690 691
## Move an issue

692
Moves an issue to a different project. If the target project
693 694
equals the source project or the user has insufficient permissions to move an
issue, error `400` together with an explaining error message is returned.
695

696 697 698
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.

699
```
700
POST /projects/:id/issues/:issue_iid/move
701 702
```

703
| Attribute       | Type    | Required | Description                          |
704
|-----------------|---------|----------|--------------------------------------|
705
| `id`            | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
706 707
| `issue_iid`     | integer | yes      | The internal ID of a project's issue |
| `to_project_id` | integer | yes      | The ID of the new project            |
708 709

```bash
710
curl --header "PRIVATE-TOKEN: <your_access_token>" --form to_project_id=5 https://gitlab.example.com/api/v4/projects/4/issues/85/move
711 712 713 714 715 716 717 718 719 720 721 722 723 724
```

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",
725
  "closed_at": null,
haseeb's avatar
haseeb committed
726
  "closed_by": null,
727
  "labels": [],
728 729
  "upvotes": 4,
  "downvotes": 0,
730
  "merge_requests_count": 0,
731
  "milestone": null,
732 733 734 735 736 737 738 739
  "assignees": [{
    "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"
  }],
740 741 742 743 744 745
  "assignee": {
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
746
    "web_url": "https://gitlab.example.com/axel.block"
747 748 749 750 751 752 753
  },
  "author": {
    "name": "Kris Steuber",
    "username": "solon.cremin",
    "id": 10,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon",
754
    "web_url": "https://gitlab.example.com/solon.cremin"
755
  },
756
  "due_date": null,
757
  "web_url": "http://example.com/example/example/issues/11",
758 759 760 761 762 763
  "time_stats": {
    "time_estimate": 0,
    "total_time_spent": 0,
    "human_time_estimate": null,
    "human_total_time_spent": null
  },
764
  "confidential": false,
765
  "discussion_locked": false,
766 767 768 769 770 771
  "_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"
  }
772 773 774
}
```

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

haseeb's avatar
haseeb committed
777 778
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

779 780
## Subscribe to an issue

781
Subscribes the authenticated user to an issue to receive notifications.
782 783
If the user is already subscribed to the issue, the status code `304`
is returned.
784 785

```
786
POST /projects/:id/issues/:issue_iid/subscribe
787 788
```

789
| Attribute   | Type    | Required | Description                          |
790
|-------------|---------|----------|--------------------------------------|
791
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
792
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
793 794

```bash
795
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/subscribe
796 797 798 799 800 801 802 803 804 805 806 807 808 809
```

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",
810
  "closed_at": null,
haseeb's avatar
haseeb committed
811
  "closed_by": null,
812
  "labels": [],
813 814
  "upvotes": 4,
  "downvotes": 0,
815
  "merge_requests_count": 0,
816
  "milestone": null,
817 818 819 820 821 822 823 824
  "assignees": [{
    "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"
  }],
825 826 827 828 829 830
  "assignee": {
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
831
    "web_url": "https://gitlab.example.com/axel.block"
832 833 834 835 836 837 838
  },
  "author": {
    "name": "Kris Steuber",
    "username": "solon.cremin",
    "id": 10,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon",
839
    "web_url": "https://gitlab.example.com/solon.cremin"
840
  },
841
  "due_date": null,
842
  "web_url": "http://example.com/example/example/issues/11",
843 844 845 846 847 848
  "time_stats": {
    "time_estimate": 0,
    "total_time_spent": 0,
    "human_time_estimate": null,
    "human_total_time_spent": null
  },
849
  "confidential": false,
850
  "discussion_locked": false,
851 852 853 854 855 856
  "_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"
  }
857 858 859
}
```

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

haseeb's avatar
haseeb committed
862 863
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

864 865
## Unsubscribe from an issue

866
Unsubscribes the authenticated user from the issue to not receive notifications
867 868
from it. If the user is not subscribed to the issue, the
status code `304` is returned.
869 870

```
871
POST /projects/:id/issues/:issue_iid/unsubscribe
872 873
```

874
| Attribute   | Type    | Required | Description                          |
875
|-------------|---------|----------|--------------------------------------|
876
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
877
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
878 879

```bash
880
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/unsubscribe
881 882
```

883 884 885 886 887 888 889 890 891 892 893 894 895
Example response:

```json
{
  "id": 93,
  "iid": 12,
  "project_id": 5,
  "title": "Incidunt et rerum ea expedita iure quibusdam.",
  "description": "Et cumque architecto sed aut ipsam.",
  "state": "opened",
  "created_at": "2016-04-05T21:41:45.217Z",
  "updated_at": "2016-04-07T13:02:37.905Z",
  "labels": [],
896 897
  "upvotes": 4,
  "downvotes": 0,
898
  "merge_requests_count": 0,
899 900 901 902 903 904 905 906 907
  "milestone": null,
  "assignee": {
    "name": "Edwardo Grady",
    "username": "keyon",
    "id": 21,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/3e6f06a86cf27fa8b56f3f74f7615987?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/keyon"
  },
908 909
  "closed_at": null,
  "closed_by": null,
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925
  "author": {
    "name": "Vivian Hermann",
    "username": "orville",
    "id": 11,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/5224fd70153710e92fb8bcf79ac29d67?s=80&d=identicon",
    "web_url": "https://gitlab.example.com/orville"
  },
  "subscribed": false,
  "due_date": null,
  "web_url": "http://example.com/example/example/issues/12",
  "confidential": false,
  "discussion_locked": false
}
```

926 927
## Create a todo

928
Manually creates a todo for the current user on an issue. If
929 930 931 932
there already exists a todo for the user on that issue, status code `304` is
returned.

```
933
POST /projects/:id/issues/:issue_iid/todo
934 935
```

936
| Attribute   | Type    | Required | Description                          |
937
|-------------|---------|----------|--------------------------------------|
938
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
939
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
940 941

```bash
942
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/todo
943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962
```

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",
963
    "web_url": "https://gitlab.example.com/root"
964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987
  },
  "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
    },
988 989 990 991 992 993 994 995
    "assignees": [{
      "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"
    }],
996 997 998 999 1000 1001
    "assignee": {
      "name": "Jarret O'Keefe",
      "username": "francisca",
      "id": 14,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
1002
      "web_url": "https://gitlab.example.com/francisca"
1003 1004 1005 1006 1007 1008 1009
    },
    "author": {
      "name": "Maxie Medhurst",
      "username": "craig_rutherford",
      "id": 12,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
1010
      "web_url": "https://gitlab.example.com/craig_rutherford"
1011 1012 1013 1014
    },
    "subscribed": true,
    "user_notes_count": 7,
    "upvotes": 0,
1015
    "downvotes": 0,
1016
    "merge_requests_count": 0,
1017
    "due_date": null,
1018
    "web_url": "http://example.com/example/example/issues/110",
1019 1020
    "confidential": false,
    "discussion_locked": false
1021 1022 1023 1024 1025 1026 1027 1028
  },
  "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"
}
```

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

haseeb's avatar
haseeb committed
1031 1032
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6][ce-17042]. This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.

1033 1034 1035 1036 1037
## Set a time estimate for an issue

Sets an estimated time of work for this issue.

```
1038
POST /projects/:id/issues/:issue_iid/time_estimate
1039 1040
```

1041
| Attribute   | Type    | Required | Description                              |
1042
|-------------|---------|----------|------------------------------------------|
1043
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
1044 1045
| `issue_iid` | integer | yes      | The internal ID of a project's issue     |
| `duration`  | string  | yes      | The duration in human format. e.g: 3h30m |
1046 1047

```bash
1048
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/time_estimate?duration=3h30m
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066
```

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.

```
1067
POST /projects/:id/issues/:issue_iid/reset_time_estimate
1068 1069
```

1070
| Attribute   | Type    | Required | Description                          |
1071
|-------------|---------|----------|--------------------------------------|
1072
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
1073
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
1074 1075

```bash
1076
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/reset_time_estimate
1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094
```

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

```
1095
POST /projects/:id/issues/:issue_iid/add_spent_time
1096 1097
```

1098
| Attribute   | Type    | Required | Description                              |
1099
|-------------|---------|----------|------------------------------------------|
1100
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
1101 1102
| `issue_iid` | integer | yes      | The internal ID of a project's issue     |
| `duration`  | string  | yes      | The duration in human format. e.g: 3h30m |
1103 1104

```bash
1105
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/add_spent_time?duration=1h
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123
```

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.

```
1124
POST /projects/:id/issues/:issue_iid/reset_spent_time
1125 1126
```

1127
| Attribute   | Type    | Required | Description                          |
1128
|-------------|---------|----------|--------------------------------------|
1129
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
1130
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
1131 1132

```bash
1133
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/reset_spent_time
1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149
```

Example response:

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

## Get time tracking stats

```
1150
GET /projects/:id/issues/:issue_iid/time_stats
1151 1152
```

1153
| Attribute   | Type    | Required | Description                          |
1154
|-------------|---------|----------|--------------------------------------|
1155
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
1156
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
1157 1158

```bash
1159
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/time_stats
1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172
```

Example response:

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

1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186
## List merge requests related to issue

Get all the merge requests that are related to the issue.

```
GET /projects/:id/issues/:issue_id/related_merge_requests
```

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

```sh
1187
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/11/related_merge_requests
1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259
```

Example response:

```json
[
  {
    "id": 29,
    "iid": 11,
    "project_id": 1,
    "title": "Provident eius eos blanditiis consequatur neque odit.",
    "description": "Ut consequatur ipsa aspernatur quisquam voluptatum fugit. Qui harum corporis quo fuga ut incidunt veritatis. Autem necessitatibus et harum occaecati nihil ea.\r\n\r\ntwitter/flight#8",
    "state": "opened",
    "created_at": "2018-09-18T14:36:15.510Z",
    "updated_at": "2018-09-19T07:45:13.089Z",
    "target_branch": "v2.x",
    "source_branch": "so_long_jquery",
    "upvotes": 0,
    "downvotes": 0,
    "author": {
      "id": 14,
      "name": "Verna Hills",
      "username": "lawanda_reinger",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/de68a91aeab1cff563795fb98a0c2cc0?s=80&d=identicon",
      "web_url": "https://gitlab.example.com/lawanda_reinger"
    },
    "assignee": {
      "id": 19,
      "name": "Jody Baumbach",
      "username": "felipa.kuvalis",
      "state": "active",
      "avatar_url": "https://www.gravatar.com/avatar/6541fc75fc4e87e203529bd275fafd07?s=80&d=identicon",
      "web_url": "https://gitlab.example.com/felipa.kuvalis"
    },
    "source_project_id": 1,
    "target_project_id": 1,
    "labels": [],
    "work_in_progress": false,
    "milestone": {
      "id": 27,
      "iid": 2,
      "project_id": 1,
      "title": "v1.0",
      "description": "Et tenetur voluptatem minima doloribus vero dignissimos vitae.",
      "state": "active",
      "created_at": "2018-09-18T14:35:44.353Z",
      "updated_at": "2018-09-18T14:35:44.353Z",
      "due_date": null,
      "start_date": null,
      "web_url": "https://gitlab.example.com/twitter/flight/milestones/2"
    },
    "merge_when_pipeline_succeeds": false,
    "merge_status": "cannot_be_merged",
    "sha": "3b7b528e9353295c1c125dad281ac5b5deae5f12",
    "merge_commit_sha": null,
    "user_notes_count": 9,
    "discussion_locked": null,
    "should_remove_source_branch": null,
    "force_remove_source_branch": false,
    "web_url": "https://gitlab.example.com/twitter/flight/merge_requests/4",
    "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
    },
    "squash": false
  }
]
```

1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273
## 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
1274
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/11/closed_by
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304
```

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,
haseeb's avatar
haseeb committed
1305 1306
    "closed_at": null,
    "closed_by": null,
1307 1308 1309 1310 1311 1312 1313 1314 1315 1316
    "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,
1317 1318 1319 1320 1321 1322 1323
    "web_url": "https://gitlab.example.com/gitlab-org/gitlab-test/merge_requests/6432",
    "time_stats": {
      "time_estimate": 0,
      "total_time_spent": 0,
      "human_time_estimate": null,
      "human_total_time_spent": null
    }
1324
  }
1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339
]
```

## Participants on issues

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

| 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
1340
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/participants
1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362
```

Example response:

```json
[
  {
    "id": 1,
    "name": "John Doe1",
    "username": "user1",
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
    "web_url": "http://localhost/user1"
  },
  {
    "id": 5,
    "name": "John Doe5",
    "username": "user5",
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80&d=identicon",
    "web_url": "http://localhost/user5"
  }
1363 1364 1365
]
```

1366 1367
## Comments on issues

1368
Comments are done via the [notes](notes.md) resource.
James Lopez's avatar
James Lopez committed
1369 1370 1371

## Get user agent details

James Lopez's avatar
James Lopez committed
1372 1373
Available only for admins.

James Lopez's avatar
James Lopez committed
1374 1375 1376 1377 1378 1379 1380 1381 1382 1383
```
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
1384
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/user_agent_detail
James Lopez's avatar
James Lopez committed
1385 1386 1387 1388 1389 1390 1391 1392
```

Example response:

```json
{
  "user_agent": "AppleWebKit/537.36",
  "ip_address": "127.0.0.1",
1393
  "akismet_submitted": false
James Lopez's avatar
James Lopez committed
1394 1395
}
```
1396 1397

[ce-13004]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13004
Hiroyuki Sato's avatar
Hiroyuki Sato committed
1398
[ce-14016]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14016
haseeb's avatar
haseeb committed
1399
[ce-17042]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17042
1400
[ce-18935]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18935