---
# System prepended metadata

title: Issue Tracker API

---

# Issue Tracker API

* 로그인, mock API를 제외하고 `Authorization` 헤더에 발급받은 JWT 토큰값이 있어야 합니다.
* Default URL : http://13.209.115.251/api
* Mock URL : http://13.209.115.251/api/mock

---

## 로그인
### Github OAuth
* 로그인 버튼에 연결할 URL
    * `https://github.com/login/oauth/authorize?client_id=1aad2658e941ef024da5&scope=user%20public_repo`
* 토큰 전달 할 scheme
    * `issuenine://oauth?token={token}`

### Apple Login
Request
```
GET {url}/applelogin

{
    "name": "poogle",
    "social_id": 231231,
    "email": "ppp@name.com"
}
```

Response

```
Response Header

KEY: Authorization
VALUE: Bearer {token}
```
```
Response Body

login
```
---
## 이슈
### 1. 이슈 상세보기

Request

```
{url}/issues/1/detail
```

Response
```
{
    "issueId": 1,
    "title": "issue 1",
    "contents": "first issue blabla",
    "author": "Solar",
    "open": true,
    "comments": [
        {
            "id": 1,
            "author": "Poogle",
            "contents": "Good!!",
            "created": "2020-06-19 13:01:23"
        },
        {
            "id": 2,
            "author": "Solar",
            "contents": "OKOK!!",
            "created": "2020-06-19 13:21:34"
        },
        {
            "id": 3,
            "author": "Poogle",
            "contents": "Hi!!",
            "created": "2020-06-19 13:34:11"
        }
    ],
    "labels": [
        {
            "id": 1,
            "title": "TEAM",
            "colorCode": "#123aaa"
        },
        {
            "id": 2,
            "title": "BE",
            "colorCode": "#008672"
        }
    ],
    "milestones": {
        "id": 1,
        "title": "changed",
        "dueOn": "2020-06-20",
        "numberOfOpenIssue": 1,
        "numberOfClosedIssue": 0
    }
}
```

---

## 레이블
### 1. 목록

Request
```
GET {url}/labels
```

Response
```
[
    {
        "id": 1,
        "title": "iOS",
        "contents": "iOS api",
        "colorCode": "#333333"
    },
    {
        "id": 2,
        "title": "BE edit",
        "contents": "BE API edit",
        "colorCode": "#123123"
    }
]
```

### 2. 생성

Request
```
POST {url}/labels

{
"title":"iOS",
"contents":"iOS api",
"colorCode":"#ffffff"
}
```

Response
```
성공 : 201 Created
실패 : 422 Unprocessable Entity
```

### 3. 수정

Request
```
PUT {url}/labels/{label-id}

{
"title":"BE",
"contents":"BE api",
"colorCode":"#ffffff"
}
```

Response
```
성공 : 204 No Content
실패 : 422 Unprocessable Entity
```


### 4. 삭제

Request
```
DELETE {url}/labels/{label-id}
```

Response
```
성공 : 204 No Content
실패 : 404 Not Found
```
---

## 마일스톤

### 1. 목록

Reqeust
```
GET {url}/milestones
```

Response
```
[
    {
        "id": 1,
        "title": "1 WEEK",
        "contents": "1주차 목표입니다.",
        "dueOn": "2020-06-13",
        "numberOfOpenIssue": 5,
        "numberOfClosedIssue": 6
    },
    {
        "id": 2,
        "title": "2 WEEK",
        "contents": "2주차 목표입니다.",
        "dueOn": "2020-06-20",
        "numberOfOpenIssue": 11,
        "numberOfClosedIssue": 1
    }
]
```

#### 2. 생성

Request
```
POST {url}/milestones

{
    "title": "2 WEEK",
    "contents": "2주차 목표입니다.",
    "dueOn": "2020-06-13"
}
```

Response
```
성공 : 201 Created
실패 : 422 Unprocessable Entity
```

### 3. 수정

Request
```
PUT {url}/milestones/{milestone-id}

{
    "title": "2 WEEK",
    "contents": "2주차 목표입니다.",
    "dueOn": "2020-06-13"
}
```

Response
```
성공 : 204 No Content
실패 :
422 Unprocessable Entity (Not null인 title이 null인 상태로 요청)
Title can't be blank

404 Not Found (존재하지 않는 milestone id로 요청했을 때)
Milestone doesn't exist
```

### 4. 삭제

Request
```
DELETE {url}/milestones/{milestone-id}
```

Response
```
성공 : 204 No Content
실패 : 404 Not Found (존재하지 않는 milestone id로 요청했을 때)
Milestone doesn't exist
```

### 5. 선택 목록

Request
```
GET {url}/milestones/picker
```

Response
```
성공 : 200 
[
    {
        "id": 1,
        "title": "1 WEEK"
    },
    {
        "id": 2,
        "title": "2 WEEK"
    },
    {
        "id": 3,
        "title": "3 WEEK"
    }
]
```
