Skip to content

나무, 나무숲 API

subin kim edited this page Jun 12, 2022 · 4 revisions

나무숲

-- GET /api/users/{userId}/forest(?page=0) -- 수정
GET /api/forest(?page=0)

응답

  • 성공
    • ForestResponseDto
    {
      "totalTreeSize": 0,
      "trees": [
        {
          "id": 0,
          "name": "string"
        }
      ]
    }
    
    • List사이즈 최대 4개, totalTreeSize최대 8개
  • 실패 400
    • page요청 잘못되었을때 (page는 0,1만 가능)
  • 실패 404
  • 존재하지 않는 userId

나무

--GET /api/users/{userId}/forest/{treeId}--수정
GET /api/forest/{treeId}
  • 성공 200
    • TreeResponseDto
    • {
        "id": 0,
        "level": 0,
        "messages": [
          {
            "anonymous": true,
            "content": "string",
            "id": 0,
            "senderNickName": "string",
            "senderProfileImage": "string"
          }
        ],
        "name": "string",
        "nextId": 0,
        "prevId": 0
      }
      
  • 실패 404
    • 존재하지 않는 treeId (prev,next 에러처리도 한번에 가능)
    • 존재하지 않는 userId

나무 추가

POST /api/forest

Request

{
  "fruitType": "APPLE",
  "name": "string"
}
  • 성공 200
    • {
        "msg": "string",
        "result": "성공"
      }
      
  • 실패 404
    • 존재하지 않는 userId

나무 편집

PUT /api/forest/{treeId}

Request

{
  "fruitType": "APPLE",
  "name": "string"
}
  • 성공 200
    • {
        "msg": "string",
        "result": "성공"
      }
      
  • 실패 404
    • 존재하지 않는 userId
    • 존재하지 않는 treeId
Clone this wiki locally