Skip to content

API 명세

woorimIT edited this page Jun 25, 2021 · 13 revisions

API 명세


🏡 홈

전체 조회

홈 화면에서 조회될 전체 데이터를 응답한다.
URL: /api/home
METHOD: GET

  • Response
    • Status: 200 OK
    • Content-Type: application/json
{
   lists: [{
      no: 13,
      title: "ToDo",
      cards: [{
         no: 1,
         content: "1일 1커밋"
      }, {
         no: 3,
         content: "문서 정리"
      }]
   }, {
      no: 21,
      title: "InProgress",
      cards: [{
         no: 2,
         content: "1일 1회화"
      }, {
         no: 3,
         content: "API 명세 정리"
      }]
   }]
}

📑 리스트

리스트 추가

URL: /api/list
METHOD: POST

  • Request
    • Content-Type: application/json
{
   title: "ToDo"
}
  • Response
    • Status: 201 Created
    • Content-Type: application/json
{
   result: "success",
   no: 1
}

🔖 카드

카드 추가

URL: /api/card
METHOD: POST

  • Request
    • Content-Type: application/json
{
   listNo: 1,
   content: "1일 1커밋"
}
  • Response
    • Status: 201 Created
    • Content-Type: application/json
{
   result: "success"
}

카드 1개 수정

URL: /api/cards/:no
METHOD: PUT

  • Request
    • Content-Type: application/json
{
   listNo: 1,
   content: "1일 1회화"
}
  • Response
    • Status: 204 No Content

카드 2개 수정

두 개의 카드 중 Drag된 노드의 position이 더 큰 경우에만 해당 API를 이용하도록 구현해야 한다.

URL: /api/cards
METHOD: PUT

  • Request
    • Content-Type: application/json
{
   nos: [1, 3], // 서로 position이 바뀐다.
   listNo: 2 // Drag된 노드의 리스트 ID
   content: "1일 1회화"
}
  • Response
    • Status: 204 No Content

카드 삭제

URL: /api/cards/:no
METHOD: DELETE

  • Response
    • Status: 204 No Content

🚫 에러 응답

404

(1) 존재하지 않는 URL에 접근했을 때
(2) 존재하지 않는 데이터에게 CRUD를 시도할 때 등

  • Status: 404 Not Found
  • Content-Type: application/json
{
   result: "error"
   msg: "존재하지 않는 리소스입니다."
}

Clone this wiki locally