2014-05-27 08:12:15 -04:00
|
|
|
# Issues
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
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).
|
|
|
|
|
2012-07-24 08:25:01 -04:00
|
|
|
## List issues
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
Get all issues created by the authenticated user.
|
2012-07-24 08:25:01 -04:00
|
|
|
|
|
|
|
```
|
|
|
|
GET /issues
|
2014-08-14 06:41:16 -04:00
|
|
|
GET /issues?state=opened
|
|
|
|
GET /issues?state=closed
|
2014-08-14 10:17:19 -04:00
|
|
|
GET /issues?labels=foo
|
|
|
|
GET /issues?labels=foo,bar
|
|
|
|
GET /issues?labels=foo,bar&state=opened
|
2012-07-24 08:25:01 -04:00
|
|
|
```
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
| Attribute | Type | Required | Description |
|
|
|
|
| --------- | ---- | -------- | ----------- |
|
|
|
|
| `state` | string | no | Return all issues or just those that are `opened` or `closed`|
|
|
|
|
| `labels` | string | no | Comma-separated list of label names |
|
|
|
|
| `order_by`| string | no | Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at` |
|
|
|
|
| `sort` | string | no | Return requests sorted in `asc` or `desc` order. Default is `desc` |
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/issues
|
|
|
|
```
|
2014-08-14 06:41:16 -04:00
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
Example response:
|
2014-08-14 06:41:16 -04:00
|
|
|
|
2012-07-24 08:25:01 -04:00
|
|
|
```json
|
|
|
|
[
|
2016-01-18 03:10:46 -05:00
|
|
|
{
|
|
|
|
"state" : "opened",
|
|
|
|
"description" : "Ratione dolores corrupti mollitia soluta quia.",
|
|
|
|
"author" : {
|
|
|
|
"state" : "active",
|
|
|
|
"id" : 18,
|
|
|
|
"web_url" : "https://gitlab.example.com/u/eileen.lowe",
|
|
|
|
"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,
|
|
|
|
"assignee" : {
|
|
|
|
"state" : "active",
|
|
|
|
"id" : 1,
|
|
|
|
"name" : "Administrator",
|
|
|
|
"web_url" : "https://gitlab.example.com/u/root",
|
|
|
|
"avatar_url" : null,
|
|
|
|
"username" : "root"
|
|
|
|
},
|
|
|
|
"updated_at" : "2016-01-04T15:31:51.081Z",
|
|
|
|
"id" : 76,
|
|
|
|
"title" : "Consequatur vero maxime deserunt laboriosam est voluptas dolorem.",
|
|
|
|
"created_at" : "2016-01-04T15:31:51.081Z",
|
|
|
|
"iid" : 6,
|
|
|
|
"labels" : []
|
|
|
|
},
|
2012-07-24 08:25:01 -04:00
|
|
|
]
|
|
|
|
```
|
|
|
|
|
|
|
|
## List project issues
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
Get a list of a project's issues.
|
2012-07-24 08:25:01 -04:00
|
|
|
|
|
|
|
```
|
|
|
|
GET /projects/:id/issues
|
2014-08-14 06:41:16 -04:00
|
|
|
GET /projects/:id/issues?state=opened
|
|
|
|
GET /projects/:id/issues?state=closed
|
2014-08-14 10:17:19 -04:00
|
|
|
GET /projects/:id/issues?labels=foo
|
|
|
|
GET /projects/:id/issues?labels=foo,bar
|
|
|
|
GET /projects/:id/issues?labels=foo,bar&state=opened
|
2014-09-04 18:01:12 -04:00
|
|
|
GET /projects/:id/issues?milestone=1.0.0
|
|
|
|
GET /projects/:id/issues?milestone=1.0.0&state=opened
|
2015-01-17 17:45:39 -05:00
|
|
|
GET /projects/:id/issues?iid=42
|
2012-07-24 08:25:01 -04:00
|
|
|
```
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
| Attribute | Type | Required | Description |
|
|
|
|
| --------- | ---- | -------- | ----------- |
|
|
|
|
| `id` | integer | yes | The ID of a project |
|
|
|
|
| `iid` | integer | no | Return the issue having the given `iid` |
|
|
|
|
| `state` | string | no | Return all issues or just those that are `opened` or `closed`|
|
|
|
|
| `labels` | string | no | Comma-separated list of label names |
|
|
|
|
| `milestone` | string| no | The milestone title |
|
|
|
|
| `order_by`| string | no | Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at` |
|
|
|
|
| `sort` | string | no | Return requests sorted in `asc` or `desc` order. Default is `desc` |
|
|
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/projects/4/issues
|
|
|
|
```
|
|
|
|
|
|
|
|
Example response:
|
2012-07-24 08:25:01 -04:00
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
```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",
|
|
|
|
"web_url" : "https://gitlab.example.com/u/root",
|
|
|
|
"avatar_url" : null,
|
|
|
|
"username" : "root",
|
|
|
|
"id" : 1,
|
|
|
|
"name" : "Administrator"
|
|
|
|
},
|
|
|
|
"description" : "Omnis vero earum sunt corporis dolor et placeat.",
|
|
|
|
"state" : "closed",
|
|
|
|
"iid" : 1,
|
|
|
|
"assignee" : {
|
|
|
|
"avatar_url" : null,
|
|
|
|
"web_url" : "https://gitlab.example.com/u/lennie",
|
|
|
|
"state" : "active",
|
|
|
|
"username" : "lennie",
|
|
|
|
"id" : 9,
|
|
|
|
"name" : "Dr. Luella Kovacek"
|
|
|
|
},
|
|
|
|
"labels" : [],
|
|
|
|
"id" : 41,
|
|
|
|
"title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
|
|
|
|
"updated_at" : "2016-01-04T15:31:46.176Z",
|
|
|
|
"created_at" : "2016-01-04T15:31:46.176Z"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|
2013-02-27 08:36:20 -05:00
|
|
|
|
2012-07-24 08:25:01 -04:00
|
|
|
## Single issue
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
Get a single project issue.
|
2012-07-24 08:25:01 -04:00
|
|
|
|
|
|
|
```
|
|
|
|
GET /projects/:id/issues/:issue_id
|
|
|
|
```
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
| Attribute | Type | Required | Description |
|
|
|
|
| --------- | ---- | -------- | ----------- |
|
|
|
|
| `id` | integer | yes | The ID of a project |
|
|
|
|
| `issue_id`| integer | yes | The ID of a project's issue |
|
2012-07-24 08:25:01 -04:00
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
```bash
|
|
|
|
curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/projects/4/issues/41
|
|
|
|
```
|
|
|
|
|
|
|
|
Example response:
|
2012-07-24 08:25:01 -04:00
|
|
|
|
|
|
|
```json
|
|
|
|
{
|
2016-01-18 03:10:46 -05:00
|
|
|
"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",
|
|
|
|
"web_url" : "https://gitlab.example.com/u/root",
|
|
|
|
"avatar_url" : null,
|
|
|
|
"username" : "root",
|
|
|
|
"id" : 1,
|
|
|
|
"name" : "Administrator"
|
|
|
|
},
|
|
|
|
"description" : "Omnis vero earum sunt corporis dolor et placeat.",
|
|
|
|
"state" : "closed",
|
|
|
|
"iid" : 1,
|
|
|
|
"assignee" : {
|
|
|
|
"avatar_url" : null,
|
|
|
|
"web_url" : "https://gitlab.example.com/u/lennie",
|
|
|
|
"state" : "active",
|
|
|
|
"username" : "lennie",
|
|
|
|
"id" : 9,
|
|
|
|
"name" : "Dr. Luella Kovacek"
|
|
|
|
},
|
|
|
|
"labels" : [],
|
|
|
|
"id" : 41,
|
|
|
|
"title" : "Ut commodi ullam eos dolores perferendis nihil sunt.",
|
|
|
|
"updated_at" : "2016-01-04T15:31:46.176Z",
|
|
|
|
"created_at" : "2016-01-04T15:31:46.176Z"
|
2012-07-24 08:25:01 -04:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## New issue
|
|
|
|
|
2013-02-27 08:36:20 -05:00
|
|
|
Creates a new project issue.
|
2012-07-24 08:25:01 -04:00
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
If the operation is successful, a status code of `200` and the newly-created
|
|
|
|
issue is returned. If an error occurs, an error number and a message explaining
|
|
|
|
the reason is returned.
|
|
|
|
|
2012-07-24 08:25:01 -04:00
|
|
|
```
|
|
|
|
POST /projects/:id/issues
|
|
|
|
```
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
| Attribute | Type | Required | Description |
|
|
|
|
| --------- | ---- | -------- | ----------- |
|
|
|
|
| `id` | integer | yes | The ID of a project |
|
|
|
|
| `title` | string | yes | The title of an issue |
|
|
|
|
| `description` | string | no | The description of an issue |
|
|
|
|
| `assignee_id` | integer | no | The ID of a user to assign issue |
|
|
|
|
| `milestone_id` | integer | no | The ID of a milestone to assign issue |
|
|
|
|
| `labels` | string | no | Comma-separated label names for an issue |
|
2016-03-25 17:21:50 -04:00
|
|
|
| `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. `2016-03-11T03:45:40Z` |
|
2016-01-18 03:10:46 -05:00
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X POST -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/projects/4/issues?title=Issues%20with%20auth&labels=bug
|
|
|
|
```
|
2012-07-24 08:25:01 -04:00
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
Example response:
|
2012-07-24 08:25:01 -04:00
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
```json
|
|
|
|
{
|
|
|
|
"project_id" : 4,
|
|
|
|
"id" : 84,
|
|
|
|
"created_at" : "2016-01-07T12:44:33.959Z",
|
|
|
|
"iid" : 14,
|
|
|
|
"title" : "Issues with auth",
|
|
|
|
"state" : "opened",
|
|
|
|
"assignee" : null,
|
|
|
|
"labels" : [
|
|
|
|
"bug"
|
|
|
|
],
|
|
|
|
"author" : {
|
|
|
|
"name" : "Alexandra Bashirian",
|
|
|
|
"avatar_url" : null,
|
|
|
|
"state" : "active",
|
|
|
|
"web_url" : "https://gitlab.example.com/u/eileen.lowe",
|
|
|
|
"id" : 18,
|
|
|
|
"username" : "eileen.lowe"
|
|
|
|
},
|
|
|
|
"description" : null,
|
|
|
|
"updated_at" : "2016-01-07T12:44:33.959Z",
|
|
|
|
"milestone" : null
|
|
|
|
}
|
|
|
|
```
|
2014-08-14 04:17:52 -04:00
|
|
|
|
2012-07-24 08:25:01 -04:00
|
|
|
## Edit issue
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
Updates an existing project issue. This call is also used to mark an issue as
|
|
|
|
closed.
|
|
|
|
|
|
|
|
If the operation is successful, a code of `200` and the updated issue is
|
|
|
|
returned. If an error occurs, an error number and a message explaining the
|
|
|
|
reason is returned.
|
2012-07-24 08:25:01 -04:00
|
|
|
|
|
|
|
```
|
|
|
|
PUT /projects/:id/issues/:issue_id
|
|
|
|
```
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
| Attribute | Type | Required | Description |
|
|
|
|
| --------- | ---- | -------- | ----------- |
|
|
|
|
| `id` | integer | yes | The ID of a project |
|
|
|
|
| `issue_id` | integer | yes | The ID of a project's issue |
|
|
|
|
| `title` | string | no | The title of an issue |
|
|
|
|
| `description` | string | no | The description of an issue |
|
|
|
|
| `assignee_id` | integer | no | The ID of a user to assign the issue to |
|
|
|
|
| `milestone_id` | integer | no | The ID of a milestone to assign the issue to |
|
|
|
|
| `labels` | string | no | Comma-separated label names for an issue |
|
|
|
|
| `state_event` | string | no | The state event of an issue. Set `close` to close the issue and `reopen` to reopen it |
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X PUT -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/projects/4/issues/85?state_event=close
|
|
|
|
```
|
2012-07-24 08:25:01 -04:00
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
Example response:
|
2013-02-27 08:36:20 -05:00
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
```json
|
|
|
|
{
|
|
|
|
"created_at" : "2016-01-07T12:46:01.410Z",
|
|
|
|
"author" : {
|
|
|
|
"name" : "Alexandra Bashirian",
|
|
|
|
"avatar_url" : null,
|
|
|
|
"username" : "eileen.lowe",
|
|
|
|
"id" : 18,
|
|
|
|
"state" : "active",
|
|
|
|
"web_url" : "https://gitlab.example.com/u/eileen.lowe"
|
|
|
|
},
|
|
|
|
"state" : "closed",
|
|
|
|
"title" : "Issues with auth",
|
|
|
|
"project_id" : 4,
|
|
|
|
"description" : null,
|
|
|
|
"updated_at" : "2016-01-07T12:55:16.213Z",
|
|
|
|
"iid" : 15,
|
|
|
|
"labels" : [
|
|
|
|
"bug"
|
|
|
|
],
|
|
|
|
"id" : 85,
|
|
|
|
"assignee" : null,
|
|
|
|
"milestone" : null
|
|
|
|
}
|
|
|
|
```
|
2014-08-14 04:17:52 -04:00
|
|
|
|
2016-03-21 09:12:52 -04:00
|
|
|
## Delete an issue
|
2013-02-27 08:36:20 -05:00
|
|
|
|
2016-03-21 09:12:52 -04:00
|
|
|
Only for admins and project owners. Soft deletes the issue in question.
|
2016-03-21 12:12:03 -04:00
|
|
|
If the operation is successful, a status code `200` is returned. In case you cannot
|
2016-03-21 09:12:52 -04:00
|
|
|
destroy this issue, or it is not present, code `404` is given.
|
2013-02-27 08:36:20 -05:00
|
|
|
|
|
|
|
```
|
|
|
|
DELETE /projects/:id/issues/:issue_id
|
|
|
|
```
|
|
|
|
|
2016-02-26 03:55:43 -05:00
|
|
|
| Attribute | Type | Required | Description |
|
|
|
|
| --------- | ---- | -------- | ----------- |
|
|
|
|
| `id` | integer | yes | The ID of a project |
|
|
|
|
| `issue_id` | integer | yes | The ID of a project's issue |
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -X DELETE -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" https://gitlab.example.com/api/v3/projects/4/issues/85
|
|
|
|
```
|
|
|
|
|
2014-04-30 11:28:05 -04:00
|
|
|
## Comments on issues
|
|
|
|
|
2016-01-18 03:10:46 -05:00
|
|
|
Comments are done via the [notes](notes.md) resource.
|