Skip to content

API 명세서

GyeongSeok_Lee edited this page Apr 8, 2023 · 30 revisions

1. Auth API

1.1. 가입

POST api/users
  • Request
{
"id" : "abc",
"password" : "123123",
"email" : "example@gmail.com",
"name" : "홍길동",
}
  • Response
SUCCESS { "code" : 200, "message" : "Success" }
FAIL { "code" : 500, "message" : "Fail" }

1.2. 로그인

POST api/users/login
  • Request
{
"id" : "abc",
"password" : " "
}
  • Response
SUCCESS { "code" : 200, "message" : "Success" }
FAIL { "code" : 500, "message" : "Fail" }

2. 운동시설 API

2.1. 주변 운동시설 조회

GET /v1/facilities?page=0&size=10&category=HEALTH&latitude=37.484231&longitude=126.929699&&distance=1500
  • Response
SUCCESS { "code" : 200, "message" : "Success" , "data" : 
[
{
"id" : 1,
"title" : "강남 스포애니",
"location" : {lat: "123.54", lng: "54.24"}
"description" : "스포애니로 오세요",
"image" : "https://spoany.img"
},
{
"id" : 2,
"title" : "강남 놀이터",
"location" : {lat: "123.54", lng: "54.24"}
"description" : "철봉 있어요",
"image" : "https://spoany.img"
},
]
FAIL { "code" : 500, "message" : "Fail" }

2.2. 운동 시설 상세

GET /api/workout/{id}
  • Response
SUCCESS { "code" : 200, "message" : "Success" , "data" : 
{
"id" : 1,
"location" : {lat: "123.54", lng: "54.24"}
"title" : "강남 스포애니",
"description" : "스포애니로 오세요",
"image" : "https://spoany.img"
}
FAIL { "code" : 500, "message" : "Fail" }

2.3. 운동 시설 추가

POST /api/workout/
  • Request
{
"location" : {lat: "123.54", lng: "54.24"}
"title" : "강남 스포애니",
"description" : "스포애니로 오세요",
"image" : "https://spoany.img"
}
  • Response
SUCCESS { "code" : 200, "message" : "Success" }
FAIL { "code" : 500, "message" : "Fail" }

2.4. 시설 검색

GET /api/search?term=term
  • Response
SUCCESS { "code" : 200, "message" : "Success" , "data" : 
[
{
"id" : 1,
"title" : "강남 스포애니",
"location" : {lat: "123.54", lng: "54.24"}
"description" : "스포애니로 오세요",
"image" : "https://spoany.img"
},
{
"id" : 2,
"title" : "강남 놀이터",
"location" : {lat: "123.54", lng: "54.24"}
"description" : "철봉 있어요",
"image" : "https://spoany.img"
},
]
FAIL { "code" : 500, "message" : "Fail" }

3. 스케쥴 API

3.1. 스케쥴

3.1.1. 스케쥴 조회

GET /api/schedules?month=202303

쿼리가 없다면 이번 달을, 쿼리가 있다면 date에 해당하는 달의 모든 리스트를 조회합니다.

  • Response
SUCCESS { "code" : 200, "message" : "Success" , "data" : 
  {
    "scheduleId": 1,
    "totalIncome": 10000,
    "totalSpend": 2000,
    "status": false,
    "date": "2023-12-14",
    "budget": "10000",
    "accountData": [
      {
        "accountId": 1,
        "title": "식료품 구매",
        "category": "식비",
        "cost": 10000,
        "type": "spend",
        "time": "T16:34",
      },
      {
        "accountId": 2,
        "title": "세뱃돈",
        "category": "용돈",
        "cost": 1000,
        "type": "income",
        "time": "T16:34",
      },
    ],
    "dayworkData": [
      {
        "dayworkId": 1,
        "title": "런닝 3km",
        "status": true,
        "color": "red",
      },
      {
        "dayworkId": 2,
        "title": "쇼핑하기",
        "status": false,
        "color": "green",
      },
      {
        "dayworkId": 3,
        "title": "심부름하기",
        "status": false,
        "color": "yellow",
      }
    ]
  }
}
FAIL { "code" : 500, "message" : "Fail" }

3.2. 가계부

3.2.1. 가계부 생성

POST /api/schedules/:date/accounts

date("YYMMDD")에 해당하는 스케쥴 내에, 신규 가계부를 작성합니다.

  • Request
{
  "title": "식료품 구매",
  "cost": 10000,
  "type": "spend",
  "category": "식비"
}

지출 카테고리 : 식비, 교육, 경조/선물, 고정지출, 술/유흥, 교통, 금융, 문화/여가, 카페/간식, 의복/미용, 주거/통신, 생활, 업무, 여행/숙박, 곗돈, 의료/건강, 쇼핑, 교육/학습, 기타

수입 카테고리 : 사업수입, 금융수입, 기타수입, 용돈

  • Response
SUCCESS { "code" : 200, "message" : "Success" }
FAIL { "code" : 500, "message" : "Fail" }

3.2.2. 가계부 수정

UPDATE /api/schedules/:date/accounts/:accountId

date에 해당하는 스케쥴 내에서, accountId에 해당하는 가계부 항목을 수정합니다.

{
  "title": "식료품 구매",
  "category": "식비",
  "cost": 10000,
  "type": "spend",
  "time": "T16:34",
}
  • Response
SUCCESS { "code" : 200, "message" : "Success"}
FAIL { "code" : 500, "message" : "Fail" }

3.2.3. 가계부 삭제

DELETE /api/schedules/:date/accounts/:accountId

date에 해당하는 스케쥴 내에서, accountId에 해당하는 가계부 항목을 삭제합니다.

  • Response
SUCCESS { "code" : 200, "message" : "Success"}
FAIL { "code" : 500, "message" : "Fail" }

3.3. Daywork

3.3.1. Daywork 생성

POST /api/schedules/:date/dayworks/

date에 해당하는 스케쥴 내에, 신규 할 일 항목을 작성합니다.

  • Request
{
  "title": "런닝 3km",
  "color": "red",
}
  • Response
SUCCESS { "code" : 200, "message" : "Success" }
FAIL { "code" : 500, "message" : "Fail" }

컬러 : 사용자가 자유롭게 할 일을 색상으로 마킹하는 카테고리, 우선은 중요도에 따라 빨,노,초만 기입하였습니다. (다양한 색상을 넣을 수있게 만들지는 의견 필요.)

컬러종류 : "red" | "yellow" | "green"

3.3.2. DayWork 수정

UPDATE /api/schedules/:date/dayworks/:dayworkId

date에 해당하는 스케쥴 내에서, dayworkId에 해당하는 할 일 항목을 수정합니다.

{
  "title": "런닝 3km",
  "color": "red",
  "status": "true"
}
  • Response
SUCCESS { "code" : 200, "message" : "Success"}
FAIL { "code" : 500, "message" : "Fail" }

3.3.3. DayWork 삭제

DELETE /api/schedules/:date/dayworks/:dayworkId

date에 해당하는 스케쥴 내에서, dayworkId에 해당하는 가계부 항목을 삭제합니다.

  • Response
SUCCESS { "code" : 200, "message" : "Success"}
FAIL { "code" : 500, "message" : "Fail" }