issues.md 55.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
## Delete an issue
643

644
Only for admins and project owners. Soft deletes the issue in question.
645 646

```
647
DELETE /projects/:id/issues/:issue_iid
648 649
```

650
| Attribute   | Type    | Required | Description                          |
651
|-------------|---------|----------|--------------------------------------|
652
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
653
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
654 655

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

659 660
## Move an issue

661
Moves an issue to a different project. If the target project
662 663
equals the source project or the user has insufficient permissions to move an
issue, error `400` together with an explaining error message is returned.
664

665 666 667
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.

668
```
669
POST /projects/:id/issues/:issue_iid/move
670 671
```

672
| Attribute       | Type    | Required | Description                          |
673
|-----------------|---------|----------|--------------------------------------|
674
| `id`            | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
675 676
| `issue_iid`     | integer | yes      | The internal ID of a project's issue |
| `to_project_id` | integer | yes      | The ID of the new project            |
677 678

```bash
679
curl --header "PRIVATE-TOKEN: <your_access_token>" --form to_project_id=5 https://gitlab.example.com/api/v4/projects/4/issues/85/move
680 681 682 683 684 685 686 687 688 689 690 691 692 693
```

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",
694
  "closed_at": null,
haseeb's avatar
haseeb committed
695
  "closed_by": null,
696
  "labels": [],
697 698
  "upvotes": 4,
  "downvotes": 0,
699
  "merge_requests_count": 0,
700
  "milestone": null,
701 702 703 704 705 706 707 708
  "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"
  }],
709 710 711 712 713 714
  "assignee": {
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
715
    "web_url": "https://gitlab.example.com/axel.block"
716 717 718 719 720 721 722
  },
  "author": {
    "name": "Kris Steuber",
    "username": "solon.cremin",
    "id": 10,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon",
723
    "web_url": "https://gitlab.example.com/solon.cremin"
724
  },
725
  "due_date": null,
726
  "web_url": "http://example.com/example/example/issues/11",
727 728 729 730 731 732
  "time_stats": {
    "time_estimate": 0,
    "total_time_spent": 0,
    "human_time_estimate": null,
    "human_total_time_spent": null
  },
733
  "confidential": false,
734
  "discussion_locked": false,
735 736 737 738 739 740
  "_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"
  }
741 742 743
}
```

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

haseeb's avatar
haseeb committed
746 747
**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.

748 749
## Subscribe to an issue

750
Subscribes the authenticated user to an issue to receive notifications.
751 752
If the user is already subscribed to the issue, the status code `304`
is returned.
753 754

```
755
POST /projects/:id/issues/:issue_iid/subscribe
756 757
```

758
| Attribute   | Type    | Required | Description                          |
759
|-------------|---------|----------|--------------------------------------|
760
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
761
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
762 763

```bash
764
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/subscribe
765 766 767 768 769 770 771 772 773 774 775 776 777 778
```

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",
779
  "closed_at": null,
haseeb's avatar
haseeb committed
780
  "closed_by": null,
781
  "labels": [],
782 783
  "upvotes": 4,
  "downvotes": 0,
784
  "merge_requests_count": 0,
785
  "milestone": null,
786 787 788 789 790 791 792 793
  "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"
  }],
794 795 796 797 798 799
  "assignee": {
    "name": "Miss Monserrate Beier",
    "username": "axel.block",
    "id": 12,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
800
    "web_url": "https://gitlab.example.com/axel.block"
801 802 803 804 805 806 807
  },
  "author": {
    "name": "Kris Steuber",
    "username": "solon.cremin",
    "id": 10,
    "state": "active",
    "avatar_url": "http://www.gravatar.com/avatar/7a190fecbaa68212a4b68aeb6e3acd10?s=80&d=identicon",
808
    "web_url": "https://gitlab.example.com/solon.cremin"
809
  },
810
  "due_date": null,
811
  "web_url": "http://example.com/example/example/issues/11",
812 813 814 815 816 817
  "time_stats": {
    "time_estimate": 0,
    "total_time_spent": 0,
    "human_time_estimate": null,
    "human_total_time_spent": null
  },
818
  "confidential": false,
819
  "discussion_locked": false,
820 821 822 823 824 825
  "_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"
  }
826 827 828
}
```

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

haseeb's avatar
haseeb committed
831 832
**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.

833 834
## Unsubscribe from an issue

835
Unsubscribes the authenticated user from the issue to not receive notifications
836 837
from it. If the user is not subscribed to the issue, the
status code `304` is returned.
838 839

```
840
POST /projects/:id/issues/:issue_iid/unsubscribe
841 842
```

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

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

852 853 854 855 856 857 858 859 860 861 862 863 864
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": [],
865 866
  "upvotes": 4,
  "downvotes": 0,
867
  "merge_requests_count": 0,
868 869 870 871 872 873 874 875 876
  "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"
  },
877 878
  "closed_at": null,
  "closed_by": null,
879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894
  "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
}
```

895 896
## Create a todo

897
Manually creates a todo for the current user on an issue. If
898 899 900 901
there already exists a todo for the user on that issue, status code `304` is
returned.

```
902
POST /projects/:id/issues/:issue_iid/todo
903 904
```

905
| Attribute   | Type    | Required | Description                          |
906
|-------------|---------|----------|--------------------------------------|
907
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
908
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
909 910

```bash
911
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/todo
912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931
```

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",
932
    "web_url": "https://gitlab.example.com/root"
933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956
  },
  "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
    },
957 958 959 960 961 962 963 964
    "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"
    }],
965 966 967 968 969 970
    "assignee": {
      "name": "Jarret O'Keefe",
      "username": "francisca",
      "id": 14,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
971
      "web_url": "https://gitlab.example.com/francisca"
972 973 974 975 976 977 978
    },
    "author": {
      "name": "Maxie Medhurst",
      "username": "craig_rutherford",
      "id": 12,
      "state": "active",
      "avatar_url": "http://www.gravatar.com/avatar/a0d477b3ea21970ce6ffcbb817b0b435?s=80&d=identicon",
979
      "web_url": "https://gitlab.example.com/craig_rutherford"
980 981 982 983
    },
    "subscribed": true,
    "user_notes_count": 7,
    "upvotes": 0,
984
    "downvotes": 0,
985
    "merge_requests_count": 0,
986
    "due_date": null,
987
    "web_url": "http://example.com/example/example/issues/110",
988 989
    "confidential": false,
    "discussion_locked": false
990 991 992 993 994 995 996 997
  },
  "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"
}
```

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

haseeb's avatar
haseeb committed
1000 1001
**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.

1002 1003 1004 1005 1006
## Set a time estimate for an issue

Sets an estimated time of work for this issue.

```
1007
POST /projects/:id/issues/:issue_iid/time_estimate
1008 1009
```

1010
| Attribute   | Type    | Required | Description                              |
1011
|-------------|---------|----------|------------------------------------------|
1012
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
1013 1014
| `issue_iid` | integer | yes      | The internal ID of a project's issue     |
| `duration`  | string  | yes      | The duration in human format. e.g: 3h30m |
1015 1016

```bash
1017
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/time_estimate?duration=3h30m
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035
```

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.

```
1036
POST /projects/:id/issues/:issue_iid/reset_time_estimate
1037 1038
```

1039
| Attribute   | Type    | Required | Description                          |
1040
|-------------|---------|----------|--------------------------------------|
1041
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
1042
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
1043 1044

```bash
1045
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/reset_time_estimate
1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063
```

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

```
1064
POST /projects/:id/issues/:issue_iid/add_spent_time
1065 1066
```

1067
| Attribute   | Type    | Required | Description                              |
1068
|-------------|---------|----------|------------------------------------------|
1069
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
1070 1071
| `issue_iid` | integer | yes      | The internal ID of a project's issue     |
| `duration`  | string  | yes      | The duration in human format. e.g: 3h30m |
1072 1073

```bash
1074
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/add_spent_time?duration=1h
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092
```

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.

```
1093
POST /projects/:id/issues/:issue_iid/reset_spent_time
1094 1095
```

1096
| Attribute   | Type    | Required | Description                          |
1097
|-------------|---------|----------|--------------------------------------|
1098
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
1099
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
1100 1101

```bash
1102
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/reset_spent_time
1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118
```

Example response:

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

## Get time tracking stats

```
1119
GET /projects/:id/issues/:issue_iid/time_stats
1120 1121
```

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

```bash
1128
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/time_stats
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141
```

Example response:

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

1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155
## 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
1156
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/11/related_merge_requests
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 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
```

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
  }
]
```

1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242
## 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
1243
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/11/closed_by
1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273
```

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
1274 1275
    "closed_at": null,
    "closed_by": null,
1276 1277 1278 1279 1280 1281 1282 1283 1284 1285
    "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,
1286 1287 1288 1289 1290 1291 1292
    "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
    }
1293
  }
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308
]
```

## 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
1309
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/participants
1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331
```

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"
  }
1332 1333 1334
]
```

1335 1336
## Comments on issues

1337
Comments are done via the [notes](notes.md) resource.
James Lopez's avatar
James Lopez committed
1338 1339 1340

## Get user agent details

James Lopez's avatar
James Lopez committed
1341 1342
Available only for admins.

James Lopez's avatar
James Lopez committed
1343 1344 1345 1346 1347 1348 1349 1350 1351 1352
```
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
1353
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
1354 1355 1356 1357 1358 1359 1360 1361
```

Example response:

```json
{
  "user_agent": "AppleWebKit/537.36",
  "ip_address": "127.0.0.1",
1362
  "akismet_submitted": false
James Lopez's avatar
James Lopez committed
1363 1364
}
```
1365 1366

[ce-13004]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13004
Hiroyuki Sato's avatar
Hiroyuki Sato committed
1367
[ce-14016]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14016
haseeb's avatar
haseeb committed
1368
[ce-17042]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17042
1369
[ce-18935]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18935