# API 명세서 1. [Authentification](https://github.com/boostcamp-2020/IssueTracker-3/wiki/WEB-API-%EB%AA%85%EC%84%B8%EC%84%9C#1-authentification) 2. [Milestone](https://github.com/boostcamp-2020/IssueTracker-3/wiki/WEB-API-%EB%AA%85%EC%84%B8%EC%84%9C#2-milestone) 3. [Labels](https://github.com/boostcamp-2020/IssueTracker-3/wiki/WEB-API-%EB%AA%85%EC%84%B8%EC%84%9C#3-label) 4. [LabelList](https://github.com/boostcamp-2020/IssueTracker-3/wiki/WEB-API-%EB%AA%85%EC%84%B8%EC%84%9C#4-labellist) 4. [Issue](https://github.com/boostcamp-2020/IssueTracker-3/wiki/WEB-API-%EB%AA%85%EC%84%B8%EC%84%9C#5-issue) 5. [Event](https://github.com/boostcamp-2020/IssueTracker-3/wiki/WEB-API-%EB%AA%85%EC%84%B8%EC%84%9C#6-event) 6. [Comment](https://github.com/boostcamp-2020/IssueTracker-3/wiki/WEB-API-%EB%AA%85%EC%84%B8%EC%84%9C#7-comment) ## 1. Authentification ### 1-1. Login | Method | URL | descripe | |:------:| ----------- |:------------------------------------------- | | POST | /auth/login | 기본로그인 정보를 보내오면 로그인을 합니다. | **Request** ```json= { userID:"[입력한 유저 아이디]", password:"[입력한 유저 비밀번호]" } ``` 로그인 페이지에 입력된 아이디와 비밀번호를 보내 줍니다. **Response** ```json= { state:"sucess" } ``` | Code | Description | |:----:|:-----------:| | 201 | 로그인 성공 | | 400 | 로그인 실패 | --- ### 1-2. Logout | Method | URL | descripe | |:------:| ----------- |:--------------------------- | | GET | /auth/logout | 토큰을 만료 시킵니다. | **Response** ```json= { state:"sucess", } ``` | Code | Description | |:----:|:-----------:| | 201 | 로그아웃 성공 | | 400 | 로그아웃 실패 | --- ### 1-3. register | Method | URL | descripe | |:------:| -------------- |:---------------------------------------------------- | | POST | /auth/register | 아이디와 패스워드,이미지를 보내주면 회원가입 합니다. | **Request** ```json= { userID:"[입력한 유저 아이디]", password:"[입력한 유저 비밀번호]" } ``` 이미지 업로드해서 보내주시면 됩니다. ( image URL 생성은 서버에서 합니다. ) **Response** ```json= { state:"sucess", } ``` | Code | Description | |:----:|:-------------:| | 201 | 회원가입 성공 | | 400 | 회원가입 실패 | --- ### 1-4. Github Login | Method | URL | descripe | |:------:| ----------- |:------------------------------------------- | | POST | /auth/github | github 를 이용한 로그인을 합니다. | github 로그인으로 다이렉트 합니다. **Response** ```json= { state:"sucess" // 실패시 fail 로 나옵니다. } ``` | Code | Description | |:----:|:-----------:| | 201 | 로그인 성공 | | 400 | 로그인 실패 | --- ## 2. MileStone ### 2-1. Get | Method | URL | descripe | |:------:| ---------- |:----------------------------------- | | GET | /milestone | 마일스톤 전체 목록을 가지고 옵니다. | 마일스톤 전체 목록을 가지고 옵니다. **Response** ```json= { milestones:[ { id:"[id]", name:"[milestone name]", description:"[description]", dueDate:"[date]", createdAt:"[date]" } ... ] } ``` | Code | Description | |:----:|:------------------:| | 200 | 목록 가져오기 성공 | | 400 | 목록 가져오기 실패 | | 401 | 권한 없음 | --- ### 2-2. Post | Method | URL | descripe | |:------:| ---------- |:----------------------------------------------------- | | POST | /milestone | Request 를 보내면 그에 맞게 마일스톤 DB에 추가합니다. | **Request** ```json= { name:"[milestone name]", description:"[milestone description]", dueDate:"[date]" } ``` 마일스톤을 새로 추가합니다. **Response** ```json= { id:"[id]", state:"[state]" } ``` | Code | Description | |:----:|:------------------:| | 200 | 목록 가져오기 성공 | | 400 | 목록 가져오기 실패 | | 401 | 권한 없음 | --- ### 2-3. Patch | Method | URL | descripe | |:------:| ---------- |:------------------------------------------------------------ | | Patch | /milestone | Request 를 보내면 그에 맞게 마일스톤 DB에 정보를 변경합니다. | **Request** ```json= { id:"[milestone id]", name:"[milestone name]", description:"[milestone description]", dueDate:"[date]", } ``` 마일스톤을 변경합니다. **Response** ```json= { state:"[state]" } ``` | Code | Description | |:----:|:------------------:| | 200 | 마일스톤 변경 성공 | | 400 | 마일스톤 변경 실패 | | 401 | 권한 없음 | --- ### 2-4. Delete | Method | URL | descripe | |:------:| ---------- |:-------------------------------------------------------------- | | Delete | /milestone | Request 를 보내면 그에 맞게 마일스톤 DB에서 정보를 삭제합니다. | **Request** ```json= { id:"[id]" } ``` 마일스톤을 삭제합니다. **Response** ```json= { state:"[state]" } ``` | Code | Description | |:----:|:------------------:| | 200 | 마일스톤 삭제 성공 | | 400 | 마일스톤 삭제 실패 | | 401 | 권한 없음 | --- ## 3. Label ### 3-1. Get | Method | URL | descripe | |:------:| ------ |:--------------------------- | | GET | /labels | label list를 불러옵니다. | **Response** ```json= { labels: [ { id : "[id]", name : "[label name]", description : "[label description]", color : "[label color #000000]", createdAt : "[date]" }, ... ] } ``` labellist를 json 으로 보내줍니다. | Code | Description | |:----:|:-----------------------------------:| | 200 | db에서 라벨목록을 성공적으로 SELECT | | 400 | 잘못된 클라이언트의 요청 | | 500 | 서버의 알수없는 오류 | ### 3-2. POST | Method | URL | descripe | |:------:| ------- |:------------------| | POST | /labels | label을 추가합니다 | **Request** ```json= { id : "[id]", name : "[label name]", description : "[label description]", color : "[label color #000000]", createdAt : "[date]", } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` HTTP status code를 보내줍니다. | Code | Description | |:----:|:-----------:| | 200 | db에 성공적으로 라벨 INSERT | | 500 | 서버의 알수없는 오류 | ### 3-3. PATCH | Method | URL | descripe | |:------:| ------- |:-------------------- | | PATCH | /labels | label 을 수정합니다. | **Request** ```json= { id : "[id]", name : "[label name]", description : "[label description]", color : "[label color #000000]", createdAt : "[date]" } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` HTTP status code를 보내줍니다. | Code | Description | |:----:|:-----------:| | 200 | db에서 라벨을 성공적으로 UPDATE | | 500 | 알수없는 오류 | ### 3-4. DELETE | Method | URL | descripe | |:------:| ---------------- |:------------------- | | DELETE | /labels | label을 삭제합니다. | **Request** ```json= { id:"[id]" } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` HTTP status code를 보내줍니다. | Code | Description | |:----:|:-----------:| | 200 | db에서 라벨을 성공적으로 DELETE | | 500 | 서버의 알수없는 오류 | --- ## 4. LabelList ### 4-1. Get | Method | URL | descripe | |:------:| ------ |:--------------------------- | | GET | /labellist | 전체 label 목록을 가져옵니다. | **Response** ```json= { comments:[ { id:"[label_id]", name : "[issue_id]", description: "[description]", color: "[color]", createdAt: "[date]" } ... ] } ``` | Code | Description | |:----:|:------------------:| | 200 | SELECT 성공 | | 400 | SELECT 실패 | | 401 | 권한 없음 | ### 4-2. POST | Method | URL | descripe | |:------:| ------ |:--------------------------- | | POST | /labellist | label를 추가합니다. | **Request** ```json= { name : "[issue_id]", description: "[description]", color: "[color] } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` | Code | Description | |:----:|:------------------:| | 200 | INSERT 성공 | | 400 | INSERT 실패 | | 401 | 권한 없음 | ### 4-3. PATCH | Method | URL | descripe | |:------:| ------ |:--------------------------- | | PATCH | /labellist | label 를 수정합니다. | **Request** ```json= { id: "[label_id]", name : "[issue_id]", description: "[description]", color: "[color] } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` | Code | Description | |:----:|:------------------:| | 200 | UPDATE 성공 | | 400 | UPDATE 실패 | | 401 | 권한 없음 | ### 4-4. DELETE | Method | URL | descripe | |:------:| ------ |:--------------------------- | | DELETE | /labellist | label를 삭제합니다. | **Request** ```json= { id: "[labelId]" } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` | Code | Description | |:----:|:------------------:| | 200 | DELETE 성공 | | 400 | DELETE 실패 | | 401 | 권한 없음 | --- ## 5. Issue ### 5-1. GET | Method | URL | descripe | |:------:| ---------- |:----------------------------- | | GET | /issue | Issue 전부 불러옵니다. | | GET | /issue/:id | 해당 id의 Issue를 불러옵니다. | **Response** ```json= { issue: [ { id : "[id]", mailestoneID : "[mailestoneID]", title:"[issue title]", body:"[issue body]", author:"[issue author]", state:"[open/close]", createdAt:"[date]", closedAt:"[date]", labels: {[ { id : "[id]", name : "[label name]", description : "[label description]", color : "[label color #000000]", createdAt : "[date]" }, ... ]}, assignee: { user : [{ id : "[id]", image:"[URL]" }, ... ], ... }, }, ... ] } ``` id를 파라매터로 가졌을 때는 한개의 issue 만, 아닌 경우 모든 issue 를 보여줍니다. | Code | Description | |:----:|:-----------------------------------:| | 200 | db에서 issue목록을 성공적으로 읽어옴 | | 400 | 잘못된 클라이언트의 요청 | | 500 | 서버의 알수없는 오류 | --- ### 5-2.POST | Method | URL | descripe | |:------:| ------ |:-------------------- | | POST | /issue | Issue 를 추가합니다. | **Request** ```json= { issue: [ { mailestoneID : "[mailestoneID]", title:"[issue title]", body:"[issue body]", author:"[issue author]", labels: {[ { id : "[id]", name : "[label name]", description : "[label description]", color : "[label color #000000]", createdAt : "[date]" }, ... ]}, assignee: { user : [{ id : "[id]", image:"[URL]" }, ... ] }, }, ... ] } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` | Code | Description | |:----:|:-----------------------------------:| | 200 | db에서 라벨목록을 성공적으로 추가함 | | 400 | 잘못된 클라이언트의 요청 | | 500 | 서버의 알수없는 오류 | --- ### 5-3.PATCH | Method | URL | descripe | |:------:| ------ |:-------------------- | | PATCH | /issue | Issue 를 수정합니다. | **Request** ```json= { issue: [ { id : "[id]", mailestoneID : "[mailestoneID]", title:"[issue title]", body:"[issue body]", author:"[issue author]", labels: {[ { id : "[id]", name : "[label name]", description : "[label description]", color : "[label color #000000]", createdAt : "[date]" }, ... ]}, assignee: { user : [{ id : "[id]", image:"[URL]" }, ... ] }, }, ... ] } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` | Code | Description | |:----:|:-----------------------------------:| | 200 | db에서 라벨목록을 성공적으로 수정함 | | 400 | 잘못된 클라이언트의 요청 | | 500 | 서버의 알수없는 오류 | --- ### 5-4. statechange | Method | URL | descripe | |:------:| ---------------------- |:-------------------------------------- | | GET | /issue/statechange/:id | 해당 id 에 issue 를 오픈/클로즈합니다. | **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` | Code | Description | |:----:|:-----------------------------------------------------------------:| | 200 | Issue 에 상태를 Open 에서 close, close 에서 Open 으로 변경합니다. | | 400 | 잘못된 클라이언트의 요청 | | 500 | 서버의 알수없는 오류 | --- ## 6. Event ### 6-1. Get | Method | URL | descripe | |:------:| ------ |:--------------------------- | | GET | /event | event 목록을 불러옵니다. | **Response** ```json= { events: [ { id : "[id]", actor : "[user name]", log : "[log string]", createdAt : "[date]" }, ... ] } ``` eventlist를 json 으로 보내줍니다. | Code | Description | |:----:|:-----------------------------------:| | 200 | db에서 이벤트 목록을 성공적으로 읽어옴 | | 400 | 잘못된 클라이언트의 요청 | | 500 | 서버의 알수없는 오류 | --- ## 7. Comment ### 7-1. Get | Method | URL | descripe | |:------:| ------ |:--------------------------- | | GET | /comments/:issueid | 해당 issue의 전체 comment를 가져옵니다. | **Response** ```json= { comments:[ { id:"[comment_id]", issueID : "[issue_id]", userID : "[user_id]", userName : "[user_name]", body : "[comment_content]", createdAt: "[date]" } ... ] } ``` | Code | Description | |:----:|:------------------:| | 200 | comment SELECT 성공 | | 400 | comment SELECT 실패 | | 401 | 권한 없음 | ### 7-2. POST | Method | URL | descripe | |:------:| ------ |:--------------------------- | | POST | /comment | comment를 추가합니다. | **Request** ```json= { issueID : "[issueID]", userID : "[userID]", userName : "[userName]", body : "[commentContent]", createdAt : "[date]" } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` | Code | Description | |:----:|:------------------:| | 200 | Comment INSERT 성공 | | 400 | Comment INSERT 실패 | | 401 | 권한 없음 | ### 7-3. PATCH | Method | URL | descripe | |:------:| ------ |:--------------------------- | | PATCH | /comment | comment 를 수정합니다. | **Request** ```json= { id: "[commentId]", issueID : "[issueID]", userID : "[userID]", userName : "[userName]", body : "[commentContent]", createdAt : "[date]" } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` | Code | Description | |:----:|:------------------:| | 200 | comment UPDATE 성공 | | 400 | comment UPDATE 실패 | | 401 | 권한 없음 | ### 7-4. DELETE | Method | URL | descripe | |:------:| ------ |:--------------------------- | | DELETE | /comment | comment를 삭제합니다. | **Request** ```json= { id: "[commentId]" } ``` **Response** ```json= { state : "[HTTP STATUS CODE]" } ``` | Code | Description | |:----:|:------------------:| | 200 | comment DELETE 성공 | | 400 | comment DELETE 실패 | | 401 | 권한 없음 | ---