2014-05-27 08:12:15 -04:00
# Issues
2012-07-24 08:25:01 -04:00
## List issues
2013-07-29 06:46:00 -04:00
Get all issues created by authenticated user. This function takes pagination parameters
2013-02-27 09:07:42 -05:00
`page` and `per_page` to restrict the list of issues.
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
```
2014-08-14 06:41:16 -04:00
Parameters:
- `state` (optional) - Return `all` issues or just those that are `opened` or `closed`
2014-08-14 10:17:19 -04:00
- `labels` (optional) - Comma-separated list of label names
2015-02-06 01:00:54 -05:00
- `order_by` (optional) - Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at`
- `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc`
2014-08-14 06:41:16 -04:00
2012-07-24 08:25:01 -04:00
```json
[
{
"id": 43,
2013-10-14 09:40:16 -04:00
"iid": 3,
2012-07-25 07:22:21 -04:00
"project_id": 8,
2012-07-24 08:25:01 -04:00
"title": "4xx/5xx pages",
"description": "",
2014-04-05 02:36:47 -04:00
"labels": [],
2012-07-24 08:25:01 -04:00
"milestone": null,
"assignee": null,
"author": {
"id": 1,
2012-12-10 17:46:31 -05:00
"username": "john_smith",
2012-07-24 08:25:01 -04:00
"email": "john@example.com",
"name": "John Smith",
2013-10-02 06:08:07 -04:00
"state": "active",
2012-07-24 08:25:01 -04:00
"created_at": "2012-05-23T08:00:58Z"
},
2013-10-02 06:08:07 -04:00
"state": "closed",
2012-07-24 08:25:01 -04:00
"updated_at": "2012-07-02T17:53:12Z",
"created_at": "2012-07-02T17:53:12Z"
},
{
"id": 42,
2013-10-14 09:40:16 -04:00
"iid": 4,
2012-07-25 07:22:21 -04:00
"project_id": 8,
2012-07-24 08:25:01 -04:00
"title": "Add user settings",
"description": "",
"labels": [
"feature"
],
"milestone": {
"id": 1,
"title": "v1.0",
"description": "",
"due_date": "2012-07-20",
2015-02-03 18:18:40 -05:00
"state": "reopened",
2012-07-24 08:25:01 -04:00
"updated_at": "2012-07-04T13:42:48Z",
"created_at": "2012-07-04T13:42:48Z"
},
"assignee": {
"id": 2,
2012-12-10 17:46:31 -05:00
"username": "jack_smith",
2012-07-24 08:25:01 -04:00
"email": "jack@example.com",
"name": "Jack Smith",
2013-10-02 06:08:07 -04:00
"state": "active",
2012-07-24 08:25:01 -04:00
"created_at": "2012-05-23T08:01:01Z"
},
"author": {
"id": 1,
2012-12-10 17:46:31 -05:00
"username": "john_smith",
2012-07-24 08:25:01 -04:00
"email": "john@example.com",
"name": "John Smith",
2013-10-02 06:08:07 -04:00
"state": "active",
2012-07-24 08:25:01 -04:00
"created_at": "2012-05-23T08:00:58Z"
},
2013-10-02 06:08:07 -04:00
"state": "opened",
2012-07-24 08:25:01 -04:00
"updated_at": "2012-07-12T13:43:19Z",
"created_at": "2012-06-28T12:58:06Z"
}
]
```
## List project issues
2013-02-27 08:36:20 -05:00
Get a list of project issues. This function accepts pagination parameters `page` and `per_page`
to return the list of project 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
2012-07-24 08:25:01 -04:00
```
Parameters:
2014-04-24 18:48:22 -04:00
- `id` (required) - The ID of a project
2014-08-14 06:41:16 -04:00
- `state` (optional) - Return `all` issues or just those that are `opened` or `closed`
2014-08-14 10:17:19 -04:00
- `labels` (optional) - Comma-separated list of label names
2014-09-04 18:01:12 -04:00
- `milestone` (optional) - Milestone title
2015-02-06 01:00:54 -05:00
- `order_by` (optional) - Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at`
- `sort` (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc`
2013-02-27 08:36:20 -05:00
2012-07-24 08:25:01 -04:00
## Single issue
2013-02-27 08:36:20 -05:00
Gets a single project issue.
2012-07-24 08:25:01 -04:00
```
GET /projects/:id/issues/:issue_id
```
Parameters:
2014-04-24 18:48:22 -04:00
- `id` (required) - The ID of a project
- `issue_id` (required) - The ID of a project issue
2012-07-24 08:25:01 -04:00
```json
{
"id": 42,
2013-10-14 09:40:16 -04:00
"iid": 3,
2012-07-25 07:22:21 -04:00
"project_id": 8,
2012-07-24 08:25:01 -04:00
"title": "Add user settings",
"description": "",
"labels": [
"feature"
],
"milestone": {
"id": 1,
"title": "v1.0",
"description": "",
"due_date": "2012-07-20",
2013-10-02 06:08:07 -04:00
"state": "closed",
2012-07-24 08:25:01 -04:00
"updated_at": "2012-07-04T13:42:48Z",
"created_at": "2012-07-04T13:42:48Z"
},
"assignee": {
"id": 2,
2012-12-10 17:46:31 -05:00
"username": "jack_smith",
2012-07-24 08:25:01 -04:00
"email": "jack@example.com",
"name": "Jack Smith",
2013-10-02 06:08:07 -04:00
"state": "active",
2012-07-24 08:25:01 -04:00
"created_at": "2012-05-23T08:01:01Z"
},
"author": {
"id": 1,
2012-12-10 17:46:31 -05:00
"username": "john_smith",
2012-07-24 08:25:01 -04:00
"email": "john@example.com",
"name": "John Smith",
2013-10-02 06:08:07 -04:00
"state": "active",
2012-07-24 08:25:01 -04:00
"created_at": "2012-05-23T08:00:58Z"
},
2013-10-02 06:08:07 -04:00
"state": "opened",
2012-07-24 08:25:01 -04:00
"updated_at": "2012-07-12T13:43:19Z",
"created_at": "2012-06-28T12:58:06Z"
}
```
## New issue
2013-02-27 08:36:20 -05:00
Creates a new project issue.
2012-07-24 08:25:01 -04:00
```
POST /projects/:id/issues
```
Parameters:
2014-04-24 18:48:22 -04:00
- `id` (required) - The ID of a project
- `title` (required) - The title of an issue
- `description` (optional) - The description of an issue
- `assignee_id` (optional) - The ID of a user to assign issue
- `milestone_id` (optional) - The ID of a milestone to assign issue
- `labels` (optional) - Comma-separated label names for an issue
2012-07-24 08:25:01 -04:00
2014-08-14 04:17:52 -04:00
If the operation is successful, 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
## Edit issue
2013-02-27 08:36:20 -05:00
Updates an existing project issue. This function is also used to mark an issue as closed.
2012-07-24 08:25:01 -04:00
```
PUT /projects/:id/issues/:issue_id
```
Parameters:
2014-04-24 18:48:22 -04:00
- `id` (required) - The ID of a project
- `issue_id` (required) - The ID of a project's issue
- `title` (optional) - The title of an issue
- `description` (optional) - The description of an issue
- `assignee_id` (optional) - The ID of a user to assign issue
- `milestone_id` (optional) - The ID of a milestone to assign issue
- `labels` (optional) - Comma-separated label names for an issue
- `state_event` (optional) - The state event of an issue ('close' to close issue and 'reopen' to reopen it)
2013-02-27 08:36:20 -05:00
2014-08-14 04:17:52 -04:00
If the operation is successful, 200 and the updated issue is returned.
If an error occurs, an error number and a message explaining the reason is returned.
2013-02-27 08:36:20 -05:00
## Delete existing issue (**Deprecated**)
2015-02-20 08:20:42 -05:00
The function is deprecated and returns a `405 Method Not Allowed` error if called. An issue gets now closed and is done by calling `PUT /projects/:id/issues/:issue_id` with parameter `state_event` set to `close` .
2013-02-27 08:36:20 -05:00
```
DELETE /projects/:id/issues/:issue_id
```
Parameters:
2014-04-24 18:48:22 -04:00
- `id` (required) - The project ID
- `issue_id` (required) - The ID of the issue
2014-04-30 11:28:05 -04:00
## Comments on issues
Comments are done via the notes resource.