API - HongzCloud/airbnb GitHub Wiki

로그인 요청

POST /login

  • Request

query params

code=asdf3421

typeCode=1(FE) or 2(iOS)

  • Response

200 Ok

{
    "name": "Jeong In Ho",
    "email": "[email protected]",
    "userId": "eNoLJ",
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjA2OTc3MjAsInVzZXJJZCI6ImVOb0xKIn0.Pv8Lfs90B7LRyCqKrob3RGjDtMgAk9ahdB8pRM1MY9Q"
}

400 Bad Request

{
    "timestamp": "2021-05-12T08:17:36.148+00:00",
    "status": 400,
    "error": "Bad Request",
    "message": "OAuth 인증에 실패 했습니다.",
    "path": "/login"
}

로그아웃 요청

GET /logout

  • Request

header

Authorization: Bearer {token}

  • Response

200 Ok

401 Unauthorized

{
    "timestamp": "2021-05-12T08:20:59.720+00:00",
    "status": 401,
    "error": "Unauthorized",
    "message": "유효하지 않은 토큰입니다.",
    "path": "/logout"
}

숙소 검색 요청

GET /houses

  • Request

query prams

checkIn=2021-05-18

checkOut=2021-05-25

minCharge=10000

maxCharge=1000000

guest=3

kid=0 유아

latitude=37.566826 위도

longitude=126.9786567 경도

  • Response

200 Ok

[
  { 
    "id": 1,
    "image": "url",
    "location": {  // FE는 임의의 초기값
      "latitude(위도)": 37.566826,
      "longitude(경도)": 126.9786567
    },
    "local": "서초구의 아파트 전체",
    "name": "Specious and Comfortable cozy bouse #4",
    "charge": "15400", // 1박 값만
    "grade": 4.60,
    "review": 270,
    "description": "강남역 5번 출구에서 도보로 이동가능합니다. ...",
    "options": [
            "최대 인원 4명 • 침실 1개 • 침대 1개 • 욕실 1개",
            "주방 • 무선 인터넷 • 에어컨 • 헤어드라이기"
        ],
    "wish": true
  }, 
  { 
    "id": 2,
    "image": "url",
    "location": {
      "latitude(위도)": 37.566826,
      "longitude(경도)": 126.9786567
    },
    "local": "서초구의 아파트 전체",
    "name": "Specious and Comfortable cozy bouse #4",
    "charge": "15400", // 1박 값만
    "grade": 4.60,
    "review": 270,
    "description": "강남역 5번 출구에서 도보로 이동가능합니다. ...",
    "options": [
            "최대 인원 4명 • 침실 1개 • 침대 1개 • 욕실 1개",
            "주방 • 무선 인터넷 • 에어컨 • 헤어드라이기"
        ],
    "wish": false
  }
]

가격 범위 요청 (그래프를 그리기 위한)

GET /houses/charges

  • Request

query prams

checkIn=2021-05-18

checkOut=2021-05-25

latitude=37.566826 위도

longitude=126.9786567 경도

  • Response

200 Ok

[
  1000, 1000, 1020, 2000, ..., 100000
]

숙소 상세 페이지 요청 (ios만 해당, 구상 중)

GET /houses/detail/{houseId}

  • Request

header

query string: houseId

  • Response

200 Ok

{
  "name": "Spacious and Comfortable cozy house #4",
  "images": ["url", "url", "url"],
  "review": 270,
  "location": "서초구, 서울, 한국",
  "host": "레지던스 전체 호스트: Jong님",
  "hostImage": "url",
  "options": [
            "최대 인원 4명 • 침실 1개 • 침대 1개 • 욕실 1개",
            "주방 • 무선 인터넷 • 에어컨 • 헤어드라이기"
        ],
  "description": "강남역 5번 출구에서 도보로 이동가능합니다. 지하철 …",
  "charge": 72206,
  "wish": false
}

숙소 예약 페이지 요청

GET /reservation/{houseId}

  • Request

query string: houseId

  • Response

200 Ok

{
  "charge": 71466,
  "cleaningRatio": 0.02,
  "serviceRatio": 7.24,
  "discountRatio": 4,
  "review": 270
}

숙소 예약 요청

POST /reservation/{houseId}

  • Request

Authorization: Bearer {token}

query string: houseId

body

{
  "date": { 
    "start": "2021-05-18",
    "end": "2021-05-25"
  },
  "people": {
    "guest(성인 + 어린이)": 3
  },
  "totalCharge": 1324500
}
  • Response

200 Ok


위시 리스트 요청

GET /wishes

  • Request

header

Authorization: Bearer {token}

  • Response

200 Ok

[
  {
    "id": 1,
    "name": "비담집, 비우고담은집",
    "charge": 308571,
    "grade": 4.98,
  },
  {
    "id": 2,
    "name": "비담집, 비우고담은집",
    "charge": 308571,
    "grade": 4.98,
  },
]

위시 요청

POST /wishes/{houseId}

  • Request

query string: houseId

header

Authorization: Bearer {token}

  • Response

200 Ok


숙소 예약 리스트 요청

GET /reservation

  • Request

header

Authorization: Bearer {token}

  • Response

200 Ok

[
  {
    "id": 1,
    "image": "url",
    "date": "2021년 5월 17일 - 2021년 6월 4일",
    "location": "서초구, 서울, 한국",
    "name": "Specious and Comfortable cozy house #4"
  },
  {
    "id": 2,
    "image": "url",
    "date": "2021년 5월 17일 - 2021년 6월 4일",
    "location": "서초구, 서울, 한국",
    "name": "Specious and Comfortable cozy house #4"
  },
]

숙소 예약 상세 정보 요청

GET /reservation/detail/{houseId}

  • Request

`query string: houseId'

header

Authorization: Bearer {token}

  • Response

200 Ok

{
  "id": 2,
  "images": "[url, url]",
  "location": "서초구, 서울, 한국",
  "name": "Specious and Comfortable cozy house #4",
  "checkIn": "2021년 5월 17일 오후 4:00",
  "checkOut": "2021년 6월 4일 오후 12:00",
  "description": {
    "host": "Jong님",
    "option": "집전체 • 게스트 3명",
    "charge": 1488195
  }
}

숙소 예약 취소 요청

DELETE /reservation/{houseId}

  • Request

query string: houseId

header

Authorization: Bearer {token}

  • Response

200 Ok