-
Notifications
You must be signed in to change notification settings - Fork 1
API 명세
woorimIT edited this page Jun 26, 2021
·
13 revisions
홈 화면에서 조회될 전체 데이터를 응답한다.
URL:/api/home
METHOD:GET
- Response
-
Status:
200 OK
-
Content-Type:
application/json
-
Status:
{
lists: [{
no: 13,
title: "ToDo",
cards: [{
no: 1,
content: "1일 1커밋",
position: 1, // 카드 위치 순서
}, {
no: 3,
content: "문서 정리",
position: 2,
}]
}, {
no: 21,
title: "InProgress",
cards: [{
no: 2,
content: "1일 1회화",
position: 3,
}, {
no: 3,
content: "API 명세 정리",
position: 4,
}]
}]
}
URL:
/api/list
METHOD:POST
- Request
-
Content-Type:
application/json
-
Content-Type:
{
title: "ToDo"
}
- Response
-
Status:
201 Created
-
Content-Type:
application/json
-
Status:
{
result: "success",
no: 1 // insertId (생성된 아이디)
}
URL:
/api/card
METHOD:POST
- Request
-
Content-Type:
application/json
-
Content-Type:
{
listNo: 1,
content: "1일 1커밋"
}
- Response
-
Status:
201 Created
-
Content-Type:
application/json
-
Status:
{
result: "success",
no: 1, // insertId (생성된 아이디)
position: 3, // 카드 위치 순서
}
URL:
/api/cards/:no
METHOD:PUT
- Request
-
Content-Type:
application/json
-
Content-Type:
{
listNo: 1,
content: "1일 1회화"
}
- Response
-
Status:
204 No Content
-
Status:
- position을 가장 큰 값으로 바꿔주는 API -> 따라서 조회시 최하단에 출력되게 된다.
URL:
/api/cards/:no/position
METHOD:PATCH
- Request
-
Content-Type:
application/json
-
Content-Type:
{
listNo: 1
}
- Response
-
Status:
204 No Content
-
Status:
- dragNo의 position을 dropNo의 position으로 바꿔준 뒤, 하위 카드들의 모든 position을 1씩 더하는 API -> 따라서 Drag된 카드가 Drop된 위치에 맞게 저장된다.
URL:
/api/cards/:dragNo/:dropNo/position
METHOD:PATCH
- Request
-
Content-Type:
application/json
-
Content-Type:
{
listNo: 1
}
- Response
-
Status:
204 No Content
-
Status:
URL:
/api/cards/:no
METHOD:DELETE
- Response
-
Status:
204 No Content
-
Status:
(1) 존재하지 않는 URL에 접근했을 때
(2) 존재하지 않는 데이터에게 CRUD를 시도할 때 등
-
Status:
404 Not Found
-
Content-Type:
application/json
{
result: "error"
msg: "존재하지 않는 리소스입니다."
}