issues.md 56 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
35
GET /issues?confidential=true
Nihad Abbasov's avatar
Nihad Abbasov committed
36 37
```

38 39 40
| Attribute           | Type             | Required   | Description                                                                                                                                         |
| ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| `state`             | string           | no         | Return all issues or just those that are `opened` or `closed`                                                                                       |
41
| `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
42
| `milestone`         | string           | no         | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone.                             |
43 44
| `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
45
| `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
46
| `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)_ |
47 48 49 50
| `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
51
| `in`                | string           | no         | Modify the scope of the `search` attribute. `title`, `description`, or a string joining them with comma. Default is `title,description`              |
52 53 54 55
| `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                                                                                                   |
56
| `confidential `     | Boolean          | no        | Filter confidential or public issues.                                                                                                                |
57 58

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

62
Example response:
63

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

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

haseeb's avatar
haseeb committed
133 134
**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.

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

156 157 158 159
| 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`                                                                 |
160
| `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. |
161
| `iids[]`            | Array[integer]   | no         | Return only the issues having the given `iid`                                                                                 |
Heinrich Lee Yu's avatar
Heinrich Lee Yu committed
162
| `milestone`         | string           | no         | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone.       |
163
| `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)_ |
164
| `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
165
| `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
166
| `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)_ |
167 168 169
| `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`                                                                   |
170 171 172 173
| `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                                                                             |
174
| `confidential `     | Boolean          | no         | Filter confidential or public issues.                                                                                         |
175 176

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

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

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

haseeb's avatar
haseeb committed
251 252
**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
253 254
## List project issues

255
Get a list of a project's issues.
Nihad Abbasov's avatar
Nihad Abbasov committed
256 257 258

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

274 275 276 277 278
| 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`                                                                 |
279
| `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
280
| `milestone`         | string           | no         | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone.       |
281
| `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)_ |
282
| `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
283
| `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
284
| `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)_ |
285 286 287
| `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`                                                                 |
288 289 290 291
| `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                                                                             |
292 293
| `confidential `     | Boolean          | no         | Filter confidential or public issues.                                                                                         |

294 295

```bash
296
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues
297 298 299
```

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

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

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

haseeb's avatar
haseeb committed
377 378
**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
379 380
## Single issue

381
Get a single project issue.
Nihad Abbasov's avatar
Nihad Abbasov committed
382 383

```
384
GET /projects/:id/issues/:issue_iid
Nihad Abbasov's avatar
Nihad Abbasov committed
385 386
```

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

392
```bash
393
curl --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/4/issues/41
394 395 396
```

Example response:
Nihad Abbasov's avatar
Nihad Abbasov committed
397 398 399

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

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

haseeb's avatar
haseeb committed
473 474
**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
475 476
## New issue

477
Creates a new project issue.
Nihad Abbasov's avatar
Nihad Abbasov committed
478 479 480 481 482

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

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

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

502
Example response:
Nihad Abbasov's avatar
Nihad Abbasov committed
503

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

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

haseeb's avatar
haseeb committed
556 557
**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
558 559
## Edit issue

560 561 562
Updates an existing project issue. This call is also used to mark an issue as
closed.

Nihad Abbasov's avatar
Nihad Abbasov committed
563
```
564
PUT /projects/:id/issues/:issue_iid
Nihad Abbasov's avatar
Nihad Abbasov committed
565 566
```

567
| Attribute      | Type    | Required | Description                                                                                                |
568
|----------------|---------|----------|------------------------------------------------------------------------------------------------------------|
569
| `id`           | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
570 571 572 573
| `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                                                                        |
574
| `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.  |
575
| `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.|
576
| `labels`       | string  | no       | Comma-separated label names for an issue. Set to an empty string to unassign all labels.                   |
577 578 579
| `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`                                           |
580
| `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. |
581

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

586
Example response:
587

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

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

haseeb's avatar
haseeb committed
647 648
**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.

649
## Delete an issue
650

651
Only for admins and project owners. Soft deletes the issue in question.
652 653

```
654
DELETE /projects/:id/issues/:issue_iid
655 656
```

657
| Attribute   | Type    | Required | Description                          |
658
|-------------|---------|----------|--------------------------------------|
659
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
660
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
661 662

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

666 667
## Move an issue

668
Moves an issue to a different project. If the target project
669 670
equals the source project or the user has insufficient permissions to move an
issue, error `400` together with an explaining error message is returned.
671

672 673 674
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.

675
```
676
POST /projects/:id/issues/:issue_iid/move
677 678
```

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

```bash
686
curl --header "PRIVATE-TOKEN: <your_access_token>" --form to_project_id=5 https://gitlab.example.com/api/v4/projects/4/issues/85/move
687 688 689 690 691 692 693 694 695 696 697 698 699 700
```

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

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

haseeb's avatar
haseeb committed
753 754
**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.

755 756
## Subscribe to an issue

757
Subscribes the authenticated user to an issue to receive notifications.
758 759
If the user is already subscribed to the issue, the status code `304`
is returned.
760 761

```
762
POST /projects/:id/issues/:issue_iid/subscribe
763 764
```

765
| Attribute   | Type    | Required | Description                          |
766
|-------------|---------|----------|--------------------------------------|
767
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
768
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
769 770

```bash
771
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/subscribe
772 773 774 775 776 777 778 779 780 781 782 783 784 785
```

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

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

haseeb's avatar
haseeb committed
838 839
**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.

840 841
## Unsubscribe from an issue

842
Unsubscribes the authenticated user from the issue to not receive notifications
843 844
from it. If the user is not subscribed to the issue, the
status code `304` is returned.
845 846

```
847
POST /projects/:id/issues/:issue_iid/unsubscribe
848 849
```

850
| Attribute   | Type    | Required | Description                          |
851
|-------------|---------|----------|--------------------------------------|
852
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
853
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
854 855

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

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

902 903
## Create a todo

904
Manually creates a todo for the current user on an issue. If
905 906 907 908
there already exists a todo for the user on that issue, status code `304` is
returned.

```
909
POST /projects/:id/issues/:issue_iid/todo
910 911
```

912
| Attribute   | Type    | Required | Description                          |
913
|-------------|---------|----------|--------------------------------------|
914
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
915
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
916 917

```bash
918
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/todo
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938
```

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

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

haseeb's avatar
haseeb committed
1007 1008
**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.

1009 1010 1011 1012 1013
## Set a time estimate for an issue

Sets an estimated time of work for this issue.

```
1014
POST /projects/:id/issues/:issue_iid/time_estimate
1015 1016
```

1017
| Attribute   | Type    | Required | Description                              |
1018
|-------------|---------|----------|------------------------------------------|
1019
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
1020 1021
| `issue_iid` | integer | yes      | The internal ID of a project's issue     |
| `duration`  | string  | yes      | The duration in human format. e.g: 3h30m |
1022 1023

```bash
1024
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/time_estimate?duration=3h30m
1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042
```

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.

```
1043
POST /projects/:id/issues/:issue_iid/reset_time_estimate
1044 1045
```

1046
| Attribute   | Type    | Required | Description                          |
1047
|-------------|---------|----------|--------------------------------------|
1048
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user  |
1049
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
1050 1051

```bash
1052
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/reset_time_estimate
1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070
```

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

```
1071
POST /projects/:id/issues/:issue_iid/add_spent_time
1072 1073
```

1074
| Attribute   | Type    | Required | Description                              |
1075
|-------------|---------|----------|------------------------------------------|
1076
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user      |
1077 1078
| `issue_iid` | integer | yes      | The internal ID of a project's issue     |
| `duration`  | string  | yes      | The duration in human format. e.g: 3h30m |
1079 1080

```bash
1081
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/add_spent_time?duration=1h
1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099
```

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.

```
1100
POST /projects/:id/issues/:issue_iid/reset_spent_time
1101 1102
```

1103
| Attribute   | Type    | Required | Description                          |
1104
|-------------|---------|----------|--------------------------------------|
1105
| `id`        | integer/string | yes      | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
1106
| `issue_iid` | integer | yes      | The internal ID of a project's issue |
1107 1108

```bash
1109
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/reset_spent_time
1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125
```

Example response:

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

## Get time tracking stats

```
1126
GET /projects/:id/issues/:issue_iid/time_stats
1127 1128
```

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

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

Example response:

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

1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162
## 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
1163
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/1/issues/11/related_merge_requests
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 1229 1230 1231 1232 1233 1234 1235
```

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

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

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
1281 1282
    "closed_at": null,
    "closed_by": null,
1283 1284 1285 1286 1287 1288 1289 1290 1291 1292
    "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,
1293 1294 1295 1296 1297 1298 1299
    "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
    }
1300
  }
1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315
]
```

## 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
1316
curl --request GET --header "PRIVATE-TOKEN: <your_access_token>" https://gitlab.example.com/api/v4/projects/5/issues/93/participants
1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338
```

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"
  }
1339 1340 1341
]
```

1342 1343
## Comments on issues

1344
Comments are done via the [notes](notes.md) resource.
James Lopez's avatar
James Lopez committed
1345 1346 1347

## Get user agent details

James Lopez's avatar
James Lopez committed
1348 1349
Available only for admins.

James Lopez's avatar
James Lopez committed
1350 1351 1352 1353 1354 1355 1356 1357 1358 1359
```
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
1360
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
1361 1362 1363 1364 1365 1366 1367 1368
```

Example response:

```json
{
  "user_agent": "AppleWebKit/537.36",
  "ip_address": "127.0.0.1",
1369
  "akismet_submitted": false
James Lopez's avatar
James Lopez committed
1370 1371
}
```
1372 1373

[ce-13004]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/13004
Hiroyuki Sato's avatar
Hiroyuki Sato committed
1374
[ce-14016]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/14016
haseeb's avatar
haseeb committed
1375
[ce-17042]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17042
1376
[ce-18935]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18935