Skip to content

API 명세서_Weathy API

Jahyun Kim edited this page Feb 27, 2021 · 62 revisions

2021.02.27 Weathy 조회, 추천 weathy 조회시 closet에 clothesNum 필드 추가 2021.02.20 Weathy 조회, 추천 weathy 조회 response json에 imgUrl 필드 추가
2021.02.20 Weathy 조회, 추천 weathy 조회 response json에 hourlyWeather 변경
2021.02.20 Weathy 조회, 추천 weathy 조회 response json에 feedback 필드 존재하지 않을 시 null 값 전송으로 수정
2021.02.20 Weathy 생성, 수정 api, request multipart/form-data로 변경, img 필드 추가
2021.02.20 Weathy 수정 api, request에 isDelete 필드 추가
2021.02.20 Weathy 생성 api, response에 weathyId 필드 추가
2021.02.20 Weathy 수정 api, img 필드 변경 경우의 수 변경

Weathy API

메소드 경로 설명 구현 여부
#008000 GET ~/users/:user-id/weathy/recommend?code={code}&date={date} 추천된 웨디 조회
#008000 GET ~/weathy?date={date} 웨디 조회
#ffa500 POST ~/weathy 웨디 기록
#0000ff PUT ~/weathy/:weathy-id 웨디 기록 수정
#ff0000 DELETE ~/weathy/:weathy-id 웨디 기록 삭제

Get Recommended Weathy

  • 일자의 추천 웨디를 조회한다
메소드 경로 설명
#008000 GET ~/users/:user-id/weathy/recommend?code={code}&date={date} 추천 웨디 조회

Header

Name Type Description Mandatory
x-access-token string 토큰 Y
x-access-token: {"token"}

Path Parameter

Name Type Description Mandatory
user-id integer 유저 고유 식별자 Y

Query string

Name Type Description Mandatory
code integer 행정 코드 Y
date date YYYY-MM-DD (e.g., 2021-01-25) Y

성공 시 Response Body

{
    "weathy": {
        "region": {
            "code": 123456,
            "name": "경기도 수원시"
        },
        "dailyWeather": {
            "date": {
                "year": 2020,
                "month": 12,
                "day": 31,
                "dayOfWeek": "목요일"
            },
            "temperature": {
                "maxTemp": 4,
                "minTemp": -3
            }
        },
        "hourlyWeather": {
            "time": "오후 12시",
            "temperature": -4,
            "climate": {
                "iconId": 500,
                "description": "조금 흐리지만 따뜻함"
            },
            "pop": 30
        },
        "closet": {
            "top": {
                "categoryId": 1,
                "clothesNum": 2,
                "clothes": [
                    {
                        "id": 1,
                        "name": "까만 후드티"
                    },
                    ...
                ]
            },
            "bottom": { ... },
            "outer": { ... },
            "etc": { ... }
        },
        "weathyId": 1,
        "stampId": 1,
        "feedback": "목도리를 하고 나갈 걸 그랬어요",
        "imgUrl": "http://example/img" 
    },
    "message": "추천 웨디 조회 성공"
}
Type Name Description
Weathy weathy 웨디 정보
- Region region 위치 정보
-- long code 행정 코드
-- string name 지역 이름
- DailyWeather dailyWeather 일자 날씨 정보
-- Date date 날짜 정보
--- int year 연도
--- int month
--- int day
--- string dayOfWeek 요일
-- HighLowTemp temperature
--- int maxTemp 최고 온도
--- int minTemp 최저 온도
- HourlyWeather hourlyWeather 시간 날씨 정보
-- string time 현재 시간
-- int temperature 현재 기온
-- Climate climate 기후 정보
--- int iconId 기후 정보 id
--- string description 기후 설명 text
-- int pop 강수 확률
- ClosetObj closet 옷장 정보 목록
-- object top 상의 정보
--- int categoryId 카테고리 id
--- int clothesNum 상의 카테고리 옷 개수
--- List<clothes> clothes 상의 카테고리 옷 정보
---- int id 상의 카테고리 옷 id
---- string name 상의 카테고리 옷 이름
-- object bottom 하의 정보
--- int categoryId 카테고리 id
--- int clothesNum 하의 카테고리 옷 개수
--- List<clothes> clothes 하의 카테고리 옷 정보
---- int id 하의 카테고리 옷 id
---- string name 하의 카테고리 옷 이름
-- object outer 외투 정보
--- int categoryId 카테고리 id
--- int clothesNum 외투 카테고리 옷 개수
--- List<clothes> clothes 외투 카테고리 옷 정보
---- int id 외투 카테고리 옷 id
---- string name 외투 카테고리 옷 이름
-- object etc 기타 정보
--- int categoryId 카테고리 id
--- int clothesNum 기타 카테고리 옷 개수
--- List<clothes> clothes 기타 카테고리 옷 정보
---- int id 기타 카테고리 옷 id
---- string name 기타 카테고리 옷 이름
- int weathyId 웨디 id
- int stampId 기록한 이모지
- string? feedback 입력한 상세 정보
- string? imgUrl weathy 기록 시 저장한 이미지 uri (없을 경우 null)
string message 상태 메시지

추천된 웨디 조회에 실패한 경우

  • status code를 204로 보낼 것임

Get Weathy

  • 특정 날짜의 웨디를 조회한다
메소드 경로 설명
#008000 GET ~/weathy?date={date} 웨디 조회

Header

Name Type Description Mandatory
x-access-token string 토큰 Y
x-access-token: {"token"}

Query Parameter

Name Type Description Mandatory
date date YYYY-MM-DD (e.g., 2021-01-25) Y

웨디 정보가 있음

{
    "weathy": {
       "region": {
            "code": 123456,
            "name": "경기도 수원시"
        },
        "dailyWeather": {
            "date": {
                "year": 2020,
                "month": 12,
                "day": 31,
                "dayOfWeek": "목요일"
            },
            "temperature": {
                "maxTemp": 4,
                "minTemp": -3
            }
        },
        "hourlyWeather": {
             "time": "오후 12시",
             "temperature": -4,
             "climate": {
                 "iconId": 500,
                 "description": "조금 흐리지만 따뜻함"
             },
             "pop": 30
         },
        "closet": {
            "top": {
                "categoryId": 1,
                "clothesNum": 2,
                "clothes": [
                    {
                        "id": 1,
                        "name": "까만 후드티"
                    },
                    ...
                ]
            },
            "bottom": { ... },
            "outer": { ... },
            "etc": { ... }
        },
        "weathyId": 1,
        "stampId": 1,
        "feedback": "목도리를 하고 나갈 걸 그랬어요",
        "imgUrl": "http://example/img"
    },
    "message": "웨디 기록 조회 성공"
}
Type Name Description
Weathy weathy 웨디 정보
- Region region 위치 정보
-- int code 행정 코드
-- string name 지역 이름
- DailyWeather dailyWeather 일자 날씨 정보
-- Date date 날짜 정보
--- int year 연도
--- int month
--- int day
--- string dayOfWeek 요일
-- HighLowTemp temperature
--- int maxTemp 최고 온도
--- int minTemp 최저 온도
- HourlyWeather hourlyWeather 시간 날씨 정보
-- string time 현재 시간
-- int temperature 현재 기온
-- Climate climate 기후 정보
--- int iconId 기후 정보 id
--- string description 기후 설명 text
-- int pop 강수 확률
- ClosetObj closet 옷장 정보 목록
-- object top 상의 정보
--- int categoryId 카테고리 id
--- int clothesNum 상의 카테고리 옷 개수
--- List<clothes> clothes 상의 카테고리 옷 정보
---- int id 상의 카테고리 옷 id
---- string name 상의 카테고리 옷 이름
-- object bottom 하의 정보
--- int categoryId 카테고리 id
--- int clothesNum 하의 카테고리 옷 개수
--- List<clothes> clothes 하의 카테고리 옷 정보
---- int id 하의 카테고리 옷 id
---- string name 하의 카테고리 옷 이름
-- object outer 외투 정보
--- int categoryId 카테고리 id
--- int clothesNum 외투 카테고리 옷 개수
--- List<clothes> clothes 외투 카테고리 옷 정보
---- int id 외투 카테고리 옷 id
---- string name 외투 카테고리 옷 이름
-- object etc 기타 정보
--- int categoryId 카테고리 id
--- int clothesNum 기타 카테고리 옷 개수
--- List<clothes> clothes 기타 카테고리 옷 정보
---- int id 기타 카테고리 옷 id
---- string name 기타 카테고리 옷 이름
- int weathyId 웨디 id
- int stampId 기록한 이모지
- string? feedback 입력한 상세 정보
- string? imgUrl weathy 기록 시 저장한 이미지 uri (없을 경우 null)
string message 상태 메시지

웨디 정보가 없음

  • status code를 204로 보낼 것임

Record Weathy

  • 웨디를 기록한다
메소드 경로 설명
#ffa500 POST /weathy 웨디 기록

Header

Name Type Description Mandatory
x-access-token string 토큰 Y
Content-Type string 컨텐츠 타입 Y
x-access-token: {"token"}
Content-Type: multipart/form-data
  • file 존재 시 추가

Body

Key: weathy
Type: application/json
Value:

Type Name Description Mandatory
integer userId 유저 고유 식별자 Y
Date date YYYY-MM-DD (e.g., 2021-01-25) Y
int code 행정 코드 Y
List<int> clothes 옷 id들의 리스트 Y
int stampId 기록한 이모지 Y
string feedback 입력한 상세 정보 Y

Key : img
Type: file
Value:

Type Description Mandatory
file 저장할 이미지 파일 Y
  • 예시 (multipart/form-data)
    "weathy": {     //application/json
        "userId": 5,
        "date": "2021-01-25",
        "code": 123456,
        "clothes": [ 1, 3, 5, 6],
        "stampId": 2,
        "feedback": ""
    },
    "img": file     //file 형태

성공 시 Response Body

{
    "message": "웨디 기록 성공",
    "weathyId": 1
}
Type Name Description
string message 상태 메시지

중복된 날짜 혹은 날씨를 가져올 수 없는 날짜에 Weathy를 작성한 경우

  • status code를 400으로 보낼 것임.
{
    "message": "잘못된 날짜에 Weathy 작성"
}

Modify Weathy

  • 웨디 기록을 수정한다
메소드 경로 설명
#0000ff PUT ~/weathy/:weathy-id 웨디 기록 수정

Header

Name Type Description Mandatory
x-access-token string 토큰 Y
Content-Type string 컨텐츠 타입 Y
x-access-token: {"token"}
Content-Type: multipart/form-data
  • 수정 : img(file) 존재 && isDelete = false
  • 유지 : img(file) = null && isDelete = false
  • 삭제 : img(file) = null && isDelete = true
  • 나머지 : 유지

Path Parameter

Name Type Description Mandatory
weahty-id integer 1 Y

Body

Key: weathy
Type: application/json
Value:

Type Name Description Mandatory
int code 행정 코드 Y
List<int> clothes 옷 id들의 리스트 Y
int stampId 기록한 이모지 Y
string feedback 입력한 상세 정보 Y
boolean isDelete 삭제여부 Y

Key: img
Type: file
Value:

Type Description Mandatory
file 저장할 이미지 파일 Y
  • 예시
    "weathy": {              //application/json
        "code": 123456,
        "clothes": [ 1, 3, 5, 6],
        "stampId": 2,
        "feedback": "",
        "isDelete": true
    },
    "img: file                 //file

성공 시 Response Body

{
    "message": "웨디 기록 수정 완료"
}
Type Name Description
string message 상태 메시지

다른 사람의 Weathy에 접근함

  • status code를 403으로 보낼 것임.
{
    "message": "권한이 없는 옷에 접근"
}

Delete Weathy

  • 웨디 기록을 삭제한다
메소드 경로 설명
#ff0000 DELETE ~/weathy/:weathy-id 웨디 기록 삭제

Header

Name Type Description Mandatory
x-access-token string 토큰 Y
Content-Type string 반환받을 타입 Y
x-access-token: {"token"}
Content-Type: application/json

Path Parameter

Name Type Description Mandatory
weahty-id integer 1 Y

성공 시 Response Body

{
    "message": "웨디 기록 삭제 성공"
}
Type Name Description
string message 상태 메시지

이미 존재하지않는 Weathy

  • status code를 204으로 보낼 것임.