Skip to content

WEB API 명세서

ji3427 edited this page Nov 12, 2020 · 33 revisions

API 명세서

⚠ Database와 맞추기 위해서 모든 값은 camel case가 아닌 snake case를 사용합니다.⚠

  1. Authentification
  2. Milestone
  3. Tag
  4. Label
  5. Issue
  6. Event
  7. Comment
  8. Assignee

1. Authentification

1-1. Login

Method URL descripe
POST /auth/login 기본로그인 정보를 보내오면 로그인을 합니다.

Request

{
    user_id:"[입력한 유저 아이디]",
    password:"[입력한 유저 비밀번호]"
}

로그인 페이지에 입력된 아이디와 비밀번호를 보내 줍니다.

Response

{
    state:"sucess",
    jwt:[json web token],
    id : [user_id_index]
}
Code Description
201 로그인 성공
400 로그인 실패

1-2. Logout

Method URL descripe
GET /auth/logout 토큰을 만료 시킵니다.

Response

{
    state:"sucess",
}
Code Description
201 로그아웃 성공
400 로그아웃 실패

1-3. register

Method URL descripe
POST /auth/register 아이디와 패스워드,이미지를 보내주면 회원가입 합니다.

Request

{
    user_id:"[입력한 유저 아이디]",
    password:"[입력한 유저 비밀번호]"
}

이미지 업로드해서 보내주시면 됩니다. ( image URL 생성은 서버에서 합니다. )

Response

{
    state:"sucess"
}
Code Description
201 회원가입 성공
400 회원가입 실패

1-4. Github Login

Method URL descripe
POST /auth/github github 를 이용한 로그인을 합니다.

github 로그인으로 다이렉트 합니다.

Response

{
    state:"sucess",
    jwt:[json web token]
    // 실패시 fail 로 나옵니다.
}
Code Description
201 로그인 성공
400 로그인 실패

1-5. Apple Login

Method URL descripe
POST /auth/apple apple 를 이용한 로그인을 합니다.

github 로그인으로 다이렉트 합니다. apple 에서 받은 accesstoken 과 jwt 를 보내주시면 됩니다.

Request

{
    수정요함

}

Response

{
    state:"sucess",
    jwt:"[jwt Token]"
    // 실패시 fail 로 나옵니다.
}

1-6. get All User

Method URL descripe
GET /auth/alluser 모든 사용자정보를 불러옵니다.

Response

[
    {
        "id": [number],
        "login_id": [userName],
        "password": "[password]",
        "img": "[img]",
        "created_at": "[createTime]",
        "type": [number]
    }
]

2. MileStone

2-1. Get

Method URL descripe
GET /milestone 마일스톤 전체 목록을 가지고 옵니다.

마일스톤 전체 목록을 가지고 옵니다.

Response

{
    milestones:[
        {
            id:"[id]",
            name:"[milestone name]",
            description:"[description]",
            due_date:"[date]",
            created_at:"[date]"
        }
        ...
    ]
}
Code Description
200 목록 가져오기 성공
400 목록 가져오기 실패
401 권한 없음

2-2. Post

Method URL descripe
POST /milestone Request 를 보내면 그에 맞게 마일스톤 DB에 추가합니다.

Request

{
    name:"[milestone name]",
    description:"[milestone description]",
    due_date:"[date]"
}

마일스톤을 새로 추가합니다.

Response

{
	[insert_id]
}
Code Description
200 목록 가져오기 성공
400 목록 가져오기 실패
401 권한 없음

2-3. Patch

Method URL descripe
Patch /milestone Request 를 보내면 그에 맞게 마일스톤 DB에 정보를 변경합니다.

Request

{
    id:"[milestone id]",
    name:"[milestone name]",
    description:"[milestone description]",
    due_date:"[date]",
}

마일스톤을 변경합니다.

Response

[HTTP STATUS CODE]
Code Description
200 마일스톤 변경 성공
400 마일스톤 변경 실패
401 권한 없음

2-4. Delete

Method URL descripe
Delete /milestone Request 를 보내면 그에 맞게 마일스톤 DB에서 정보를 삭제합니다.

Request

{
    id:"[id]"
}

마일스톤을 삭제합니다.

Response

[HTTP STATUS CODE]
Code Description
200 마일스톤 삭제 성공
400 마일스톤 삭제 실패
401 권한 없음

3. Tag

3-1. GET

Method URL descripe
GET /tag/:issueid 해당 이슈의 라벨을 가져옵니다

Response

{
   [
   		id : [tag_id],
   		name : [label_name],
   		color : [label_color]
   ]
   ...
}

3-2. PATCH

Method URL descripe
PATCH /tag/:issueid 해당 이슈의 라벨을 수정합니다.

Request

{
    tags : [
    	[label_id],
    	...
    ]
}

Response

[HTTP STATUS CODE]

HTTP status code를 보내줍니다.

Code Description
200 해당 이슈의 라벨을 수정
500 서버의 알수없는 오류

4. Label

4-1. Get

Method URL descripe
GET /label 전체 label 목록을 가져옵니다.

Response

{
    labels:[
        {
            id:"[label_id]",
            name : "[label_name]",
            description: "[description]",
            color: "[color]",
            created_at: "[date]"
        }
        ...
    ]
}
Code Description
200 SELECT 성공
400 SELECT 실패
401 권한 없음

4-2. POST

Method URL descripe
POST /label label를 추가합니다.

Request

{
    name : "[label_name]",
    description: "[description]",
    color: "[color]
}

Response

{
	[insert_id]
}
Code Description
200 INSERT 성공
400 INSERT 실패
401 권한 없음

4-3. PATCH

Method URL descripe
PATCH /label label 를 수정합니다.

Request

{
    id: "[label_id]",
    name : "[issue_id]",
    description: "[description]",
    color: "[color]
}

Response

[HTTP STATUS CODE]
Code Description
200 UPDATE 성공
400 UPDATE 실패
401 권한 없음

4-4. DELETE

Method URL descripe
DELETE /label label를 삭제합니다.

Request

{
    id: "[label_id]"
}

Response

[HTTP STATUS CODE]
Code Description
200 DELETE 성공
400 DELETE 실패
401 권한 없음

5. Issue

5-1. GET

Method URL descripe
GET /issue Issue 전부 불러옵니다.

Response

{
    issue: [
        {
            id : "[id]",
            mailestone_id : "[mailestoneID]",
            title:"[issue title]",
            body:"[issue body]",
            author:"[issue author]",
            state:"[open(1)/close(0)]",
            created_at:"[date]",
            closed_at:"[date]",
            labels: [
            	...[label]
            ],
            assignee: [
            	...[assignee]
            ],
            comment: [
            	...[comment],
            	count : [count of comments]
            ]
        },
        ...
    ]
}

모든 issue 를 보여줍니다.

Code Description
200 db에서 issue목록을 성공적으로 읽어옴
400 잘못된 클라이언트의 요청
500 서버의 알수없는 오류

5-1-1. GET(Filter)

Method URL descripe
GET /filter/state/:state/author/:author/assignee/:assignee/comment/:comment 필터링된 issue를 불러옵니다.

Response

{
	// 필터된 issue
    issue: [
        {
            id : "[id]",
            mailestone_id : "[mailestoneID]",
            title:"[issue title]",
            body:"[issue body]",
            author:"[issue author]",
            state:"[open(1)/close(0)]",
            created_at:"[date]",
            closed_at:"[date]",
            labels: [
            	...[label]
            ],
            assignee: [
            	...[assignee]
            ],
            comment: [
            	...[comment],
            	count : [count of comments]
            ]
        },
        ...
    ]
}

필터링된 issue 를 보여줍니다.

Code Description
200 db에서 issue목록을 성공적으로 읽어옴
400 잘못된 클라이언트의 요청
500 서버의 알수없는 오류

5-2.POST

Method URL descripe
POST /issue Issue 를 추가합니다.

Request

{
    mailestone_id : "[mailestone_id]",
    title:"[issue title]",
    body:"[issue body]",
    author:"[issue author]",
}

Response

{
	[insert_id]
}
Code Description
200 db에서 라벨목록을 성공적으로 추가함
400 잘못된 클라이언트의 요청
500 서버의 알수없는 오류

5-3.PATCH

Method URL descripe
PATCH /issue Issue 를 수정합니다.

Request

{
    id : [id],
    title : ["title"],
    body : ["body"],
    user_id : ["user_id"],
    created_at : ["created_at"],
    closed_at : ["closed_at"],
    state : true
    milestone_id : [milestone_id]
}

Response

[HTTP STATUS CODE]
Code Description
200 db에서 라벨목록을 성공적으로 수정함
400 잘못된 클라이언트의 요청
500 서버의 알수없는 오류

5-4. statechange

Method URL descripe
PATCH /issue/:id/state/:state 해당 id 에 issue 를 오픈(1)/클로즈(0)합니다.

Response

[HTTP STATUS CODE]
Code Description
200 Issue 에 상태를 Open 에서 close, close 에서 Open 으로 변경합니다.
400 잘못된 클라이언트의 요청
500 서버의 알수없는 오류

6. Event

6-1. Get

Method URL descripe
GET /event/issueid 해당 issue의 event 목록을 불러옵니다.

Response

{
    events: [
        {
            id : "[id]",
            issue_id : "[issue_id]"
            user_id : "[user_name]",
            log : "[log]",
            created_at : "[date]"
        },
        ...
    ]
}

eventlist를 json 으로 보내줍니다.

6-2. POST

Method URL descripe
POST /event/issueid 해당 issue에 event를 추가합니다.

Resquest

{
    user_id : [user_id],
    log : ["log"]
}

Response

[HTTP STATUS CODE]
Code Description
200 db에서 이벤트 목록을 성공적으로 읽어옴
400 잘못된 클라이언트의 요청
500 서버의 알수없는 오류

7. Comment

7-1. Get

Method URL descripe
GET /comment/:issueid 해당 issue의 전체 comment를 가져옵니다.

Response

{
    comments:[
        {
            id:"[comment_id]",
            issue_id : "[issue_id]",
            user_id : "[user_id]",     
            body : "[comment_content]",
            //emoji : "[선택사항]",
            created_at: "[date]"
        }
        ...
    ]
}

7-2. POST

Method URL descripe
POST /comment comment를 추가합니다.

Request

{
    issue_id : ["issue_id"],
    user_id : ["user_id"],
    body : ["body"],
    emoji : ["emoji"]
}

Response

{
	[insert_id]
}
Code Description
200 Comment INSERT 성공
400 Comment INSERT 실패
401 권한 없음

7-3. PATCH

Method URL descripe
PATCH /comment comment 를 수정합니다.

Request

{
    id: [id],
    issue_id : [issue_id],
    user_id : [user_id],
    body : ["commentContent"],
    emoji : ["emoji"]
}

Response

[HTTP STATUS CODE]
Code Description
200 comment UPDATE 성공
400 comment UPDATE 실패
401 권한 없음

7-4. DELETE

Method URL descripe
DELETE /comment comment를 삭제합니다.

Request

{
    id: "[commentId]"
}

Response

[HTTP STATUS CODE]
Code Description
200 comment DELETE 성공
400 comment DELETE 실패
401 권한 없음

8. Assignee

8-1. GET

Method URL descripe
GET /assignee/:issueid 해당 issue의 assignee를 받아옵니다.

Response

{
    [
    	id : "[assignee_id]",
    	login_id : "[login_id]",
    	img : "[img_url]"
    ],
    ...
}

8-2. PATCH

Method URL descripe
PATCH /assignee/:issueid 해당 issue의 assginee를 수정합니다.

Request

{
    assignees : [
    	[user_id],
    	...
    ]
}

Response

[HTTP STATUS CODE]
Code Description
200 ASSIGNEE PATCH 성공
400 ASSIGNEE PATCH실패
401 권한 없음

Clone this wiki locally