Skip to content

API 명세

Sol edited this page Apr 13, 2022 · 3 revisions

ToDo List API

기능명 Method URL
모든 카드 조회 GET /api/cards
카드 생성 POST /api/cards
카드 조회 GET /api/cards/{id}
카드 삭제 DELETE /api/cards/{id}
카드 수정 PATCH /api/cards/{id}
카드 이동 PATCH ​/api​/cards​/move​/{movingCardId}
세션 & 카드 조회 GET ​/api​/cards​/section​/{sectionId}

Response Parameters(JSON)

Name Type Description
id Long unique identifier
author String 제목
sectionId Integer 일의 상태값(Todo, In progress, Done)
subject String /api/cards/{id}
contents String /api/cards/{id}
createdAt DateTime ​생성시간
updatedAt DateTime ​수정시간
모든 카드 조회

요청 데이터

응답 데이터

[
  {
    "section": {
      "id": 1,
      "name": "to do"
    },
    "cards": [
      {
        "id": 1,
        "author": "iOS",
        "sectionId": 1,
        "subject": "제목1-1",
        "contents": "본문1-1",
        "createdAt": [2022,4,13,0,41,42]
      }
    ]
  },
  {
    "section": {
      "id": 2,
      "name": "in progress"
    },
    "cards": [
      {
        "id": 2,
        "author": "iOS",
        "sectionId": 2,
        "subject": "제목2-1",
        "contents": "본문2-1",
        "createdAt": [2022,4,13,0,42,55]
      }
    ]
  },
  {
    "section": {
      "id": 3,
      "name": "done"
    },
    "cards": [
      {
        "id": 16,
        "author": "iOS",
        "sectionId": 3,
        "subject": "제목3-1",
        "contents": "본문3-1",
        "createdAt": [2022,4,13,0,43,4]
      }
    ]
  }
]
카드 생성

요청 데이터

{
  "author": "iOS",
  "contents": "본문1-1",
  "sectionId": 1,
  "subject": "제목1-1"
}

응답 데이터

{
  "id": 1,
  "author": "iOS",
  "sectionId": 1,
  "subject": "제목1-1",
  "contents": "본문1-1",
  "createdAt": [2022,4,13,0,43,4,71149000]
}
카드 조회

요청 데이터

{
  "id": 1
}

응답 데이터

{
  "id": 1,
  "author": "iOS",
  "sectionId": 1,
  "subject": "제목1-1",
  "contents": "본문1-1",
  "createdAt": [2022,4,13,0,43,4]
}
카드 삭제

요청 데이터

{
  "id": 1 // 아무 것도 안넘겨 드리는걸로 수정 (URL에 id가 포함될 것이라)
}

응답 데이터

true
카드 수정(**수정필요**)

요청 데이터

{
  "author": "iOS", // author는 카드 생성 경우에만 보내드릴 걸로 수정
  "contents": "본문변경1-1",
  "id": 1, // 해당 부분도 URL에 포함될 것이라 포함 안되는 걸로 수정
  "sectionId": 1, // 안넘겨드려도 괜찮은 걸로 수정!
  "subject": "제목1-1"
}

응답 데이터

{
  "id": 1,
  "author": "iOS",
  "sectionId": 1,
  "subject": "제목1-1",
  "contents": "본문변경1-1",
  "createdAt": [2022,4,13,1,20,25,889066000]
}
카드 이동

요청 데이터

{
  "sectionId": sectionId,
  "targetCardId": id
}

응답 데이터

true
세션 & 카드 조회

요청 데이터

응답 데이터

{
  "section": {
    "id": 2,
    "name": "in progress"
  },
  "cards": [
    {
      "id": 3,
      "author": "iOS",
      "sectionId": 2,
      "subject": "제목1-1",
      "contents": "본문변경1-1",
      "createdAt": [2022,4,13,0,41,42]
    },
    {
      "id": 2,
      "author": "iOS",
      "sectionId": 2,
      "subject": "제목2-1",
      "contents": "본문2-1",
      "createdAt": [2022,4,13,0,42,55]
    }
  ]
}

Clone this wiki locally