Skip to content

API Docs

Hyeonu Yun edited this page Dec 14, 2020 · 49 revisions

API Documentation

⚠️ 꾸준히 업데이트 중입니다 ⚠️

API 개발할 때마다 요청 변수(서브 쿼리 내용), reqeust body, response, 요청문 샘플을 적어주기

  • GET일때는 요청문 예시, 응답 정보, 응답 예시
  • POST일때는 요청 body 정보, 요청 body 예시, 응답 정보, 응답 예시
  • PATCH일때는 요청 body 정보, 요청 body 예시, 응답 정보, 응답 예시
  • DELETE일때는 요청문 예시, 응답 정보, 응답 예시

Summary

메서드 요청 URI 설명
GET api/oauth/logout 로그아웃
메서드 요청 URI 설명
POST api/accountbooks 가계부 생성
GET api/accountbooks 유저가 소유한 가계부 목록 조회
PATCH api/accountbooks/:accountbook_id 관리자가 수행하는 가계부 설정 수정
PATCH api/accountbooks/:accountbook_id 일반구성원이 수행하는 가계부 표지 수정
DELETE api/accountbooks/:accountbook_id 가계부 삭제
메서드 요청 URI 설명
POST api/social 가계부에 구성원을 추가
GET api/social/users/?accountbook_id 가계부에 있는 유저 목록 조회
GET api/social/?user_email email을 통해서 특정 유저 조회
PATCH api/social/:user_accountbook_id 특정 구성원에게 관리자 권한 부여
DELETE api/social/?user_id&accountbook_id 가계부 내 특정 유저를 추방
메서드 요청 URI 설명
POST api/transactions/income 가계부 수입 내역 생성
POST api/transactions/expenditure 가계부 지출 내역 생성
POST api/transactions/text-parsing 결제 내역 SMS/MMS 내용을 적절하게 파싱
GET api/transacions?accountbook_id&start_date&end_date 가계부 수입 지출 내역 조회
PATCH api/transactions/income/:income_id 가계부 내 특정 수입 내역 수정
PATCH api/transactions/expenditure/:expenditure_id 가계부 내 특정 지출 내역 수정
DELETE api/transactions/income/:income_id 가계부 내 특정 수입 내역 삭제
DELETE api/transactions/expenditure/:expenditure_id 가계부 내 특정 지출 내역 삭제
메서드 요청 URI 설명
POST api/categories/income 수입 카테고리 생성
POST api/categories/expenditure 지출 카테고리 생성
GET api/categories/income/?accountbook_id 수입 카테고리 조회
GET api/categories/expenditure/?accountbook_id 지출 카테고리 조회
PATCH api/categories/income/:income_category_id 수입 카테고리 수정
PATCH api/categories/expenditure/:expenditure_category_id 지출 카테고리 수정
DELETE api/categories/income/:income_category_id 수입 카테고리 삭제
DELETE api/categories/expenditure/:expenditure_category_id 지출 카테고리 삭제
메서드 요청 URI 설명
POST api/accounts 새로운 계좌(결제수단) 생성
GET api/accounts/?accountbook_id 계좌(결제수단) 목록 조회
PATCH api/accounts/:account_id 계좌(결제수단) 수정
DELETE api/accounts/:account_id 계좌(결제수단) 삭제

1. 유저 (User)

1-1. 로그아웃

메서드 요청 URI 설명
GET api/oauth/logout 로그아웃

요청 (Request)

요청문 예시

http://localhost:5000/api/oauth/logout

응답 (Response)

  • ctx.cookies에 jwt 토큰값이 사라진다.

응답 코드

  • 로그아웃이 성공적으로 수행될 경우, status 204
  • 로그아웃이 실패했을 경우, status 401

2. 가계부 (Accountbook)

2-1. 가계부 생성

메서드 요청 URI 설명
POST api/accountbooks 가계부 생성

요청 (Request)

요청문 예시

http://localhost:5000/api/accountbooks

body

{ 
    "title": "모아 공동 가계부", 
    "color": "#123456",
    "description": "민수, 병화, 영근, 현우의 공동 가계부"
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
title string Y - 해당 가계부의 이름
description String Y - 사용자가 설정해놓은 가계부에 대한 설명
color String Y - 사용자가 설정해놓은 가계부 색상

응답 (Response)

응답 예시

{
    "id": 11,
    "authority": 1,
    "description": "민수, 병화, 영근, 현우의 공동 가계부",
    "color": "#123456",
    "accountbookId": 4,
    "accountbook.title": "모아 공동 가계부"
}

응답 정보

필드 데이터 타입 설명
id Integer 사용자와 가계부 간 관계 테이블 내 고유 식별 번호
authority Boolean 해당 가계부에 대한 관리자 권한 여부
- true: 관리자 권한
- false: 일반 사용자 권한
* POST 메서드의 응답에서 authority는 무조건 true
description String 사용자가 설정해놓은 가계부에 대한 설명
color String 사용자가 설정해놓은 가계부 색상
accountbookId Integer 해당 가계부의 고유 식별 번호
accountbook.title string 해당 가계부의 이름

2-2. 가계부 목록 조회

메서드 요청 URI 설명
GET api/accountbooks 유저가 소유한 가계부 목록 조회

요청 (Request)

요청문 예시

http://localhost:5000/api/accountbooks

응답 (Response)

응답 예시

[
    {
        "id": 2,
        "authority": false,
        "description": "테스트용 accountbook",
        "color": "#1E90FF",
        "accountbookId":1
        "accountbook.title": "accountbook"
    },
    ...
]

응답 정보

필드 데이터 타입 설명
id Integer 사용자와 가계부 간 관계 테이블 내 고유 식별 번호
authority Boolean 해당 가계부에 대한 관리자 권한 여부
description String 사용자가 설정해놓은 가계부에 대한 설명
color String 사용자가 설정해놓은 가계부 색상
accountbookId Integer 해당 가계부의 고유 식별 번호
accountbook.title string 해당 가계부의 이름

2.5 가계부 삭제

메서드 요청 URI description
DELETE api/accountbooks/:accountbook_id 가계부 삭제

요청 (Request)

요청문 예시

localhost:5000/api/accountbooks/1

응답 (Response)

  • 삭제 성공 시 204 status 응답

3. 소셜(social)

3.1 가계부에 구성원을 추가

메서드 요청 URI description
POST api/social 가계부에 구성원을 추가

요청 (Request)

요청문 예시

localhost:5000/api/social

body

{ 
    "accountbookId":1, 
    "userId":4
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
accountbookId Integer Y - 가계부 id
userId Integer Y - 유저 id

응답 (Response)

응답 예시

{
    "id": 18,
    "authority": false,
    "user": {
        "id": 4,
        "nickname": "mu1616",
        "email": "[email protected]",
        "profileUrl": "https://ssl.pstatic.net/static/pwe/address/img_profile.png"
    }
}

응답 정보

필드 데이터 타입 설명
id Integer UserAccountbook id
authority boolean 권한
user object 유저 정보

3.2 가계부에 있는 유저 목록 조회

메서드 요청 URI description
GET api/social/users/?accountbook_id 가계부에 있는 유저 목록 조회

요청 (Request)

요청문 예시

localhost:5000/api/social/users/?accountbook_id=1

응답 (Response)

응답 예시

[
    {
        "id": 1,
        "authority": true,
        "user": {
            "id": 1,
            "nickname": "lacomaco122",
            "email": "[email protected]",
            "profileUrl": "https://i.imgur.com/0kGli9o.jpg"
        }
    },
    {
        "id": 2,
        "authority": false,
        "user": {
            "id": 2,
            "nickname": "dbsgusdn34",
            "email": "[email protected]",
            "profileUrl": "http://k.kakaocdn.net/dn/bVj1JP/btqNf61kIPC/HNvrQA2X1Cylb17MxtPVm1/img_640x640.jpg"
        }
    },
    {
        "id": 3,
        "authority": false,
        "user": {
            "id": 3,
            "nickname": "bhko0524",
            "email": "[email protected]",
            "profileUrl": "https://ssl.pstatic.net/static/pwe/address/img_profile.png"
        }
    },
    {
        "id": 18,
        "authority": false,
        "user": {
            "id": 4,
            "nickname": "mu1616",
            "email": "[email protected]",
            "profileUrl": "https://ssl.pstatic.net/static/pwe/address/img_profile.png"
        }
    }
]

응답 정보

필드 데이터 타입 설명
id Integer UserAccountbook id
authority boolean 권한
user object 유저 정보

3.3 email을 통해서 특정 유저 조회

메서드 요청 URI description
GET api/social/?user_email email을 통해서 특정 유저 조회

요청 (Request)

요청문 예시

localhost:5000/api/social/[email protected]

응답 (Response)

응답 예시

{
    "id": 4,
    "email": "[email protected]",
    "nickname": "mu1616",
    "profileUrl": "https://ssl.pstatic.net/static/pwe/address/img_profile.png"
}

응답 정보

필드 데이터 타입 설명
id Integer 유저 id
email string 유저 이메일
nickname string 유저 닉네임
ProfileUrl string 유저 프로필이미지 주소

3.4 특정 구성원에게 관리자 권한 부여

메서드 요청 URI description
PATCH api/social/:user_accountbook_id 특정 구성원에게 관리자 권한 부여

요청 (Request)

요청문 예시

localhost:5000/api/social/5

body

{ 
    "authority":1, 
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
authority boolean Y - 권한(1=admin,0=일반유저)

응답 (Response)

응답 예시

{
    id: 5,
    authority: true,
    accountbookId: 1,
    user: {
      id: 6,
      nickname: 'dpqjdy7777',
      email: '[email protected]',
      profileUrl: 'https://i.imgur.com/0kGli9o.jpg',
      provider: 'naver'
    }
}

응답 정보

필드 데이터 타입 설명
id Integer user_accountbook id
authority boolean 권한
accountbookId Integer accountbook id
user object 유저 정보

3.5 가계부 내 특정 유저를 추방

메서드 요청 URI description
DELETE api/social/?user_id&accountbook_id 가계부 내 특정 유저를 추방

요청 (Request)

요청문 예시

localhost:5000/api/social/?user_id=4&accountbook_id=1

응답 (Response)

  • 삭제 성공 시 204 status 응답

4. 거래 내역 (Transaction)

4.1 수입 거래내역 생성

메서드 요청 URI description
POST api/transactions/income 수입 거래내역 생성

요청 (Request)

요청문 예시

localhost:5000/api/transactions/income

body

{ 
    "accountbookId":1, 
    "incomeCategoryId":1,
    "accountId":1, 
    "amount":5000, 
    "content":"안녕하세요", 
    "date":"2020-12-04", 
    "memo":"반갑습니다."
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
accountbookId Integer Y - 가계부 id
incomeCategoryId Integer Y - 수입 카테고리 id
accountId Integer Y - 결제수단 Id
amount Integer Y - 거래금액
content string Y - 거래내역 내용
date date format Y - 거래일
memo string N - 거래내역 메모

응답 (Response)

응답 예시

{
    "id": 23,
    "amount": 5000,
    "content": "안녕하세요",
    "date": "2020-12-04T00:00:00.000Z",
    "memo": "반갑습니다.",
    "category": {
        "id": 1,
        "name": "타행이체",
        "color": "#1E90FF"
    },
    "account": {
        "id": 1,
        "name": "삼성카드",
        "color": "#1E90FF"
    }
}

응답 정보

필드 데이터 타입 설명
id Integer 거래내역 id
amount Integer 거래금액
content string 거래내역 내용
date date format 거래일
memo string 거래내역 메모
category object 수입 카테고리
account object 결제수단 카테고리

4.2 지출 거래내역 생성

메서드 요청 URI description
POST api/transactions/expenditure 지출 거래내역 생성

요청 (Request)

요청문 예시

localhost:5000/api/transactions/expenditure

body

{ 
    "accountbookId":1, 
    "expenditureCategoryId":1,
    "accountId":1, 
    "amount":5000, 
    "place":"안녕하세요", 
    "date":"2020-12-04", 
    "memo":"반갑습니다."
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
accountbookId Integer Y - 가계부 id
incomeCategoryId Integer Y - 수입 카테고리 id
accountId Integer Y - 결제수단 Id
amount Integer Y - 거래금액
place string Y - 거래내역 내용
date date format Y - 거래일
memo string N - 거래내역 메모

응답 (Response)

응답 예시

{
    "id": 16,
    "amount": 5000,
    "place": "장소",
    "date": "2020-12-04T00:00:00.000Z",
    "memo": "반갑습니다.",
    "category": {
        "id": 1,
        "name": "식사",
        "color": "#1E90FF"
    },
    "account": {
        "id": 1,
        "name": "삼성카드",
        "color": "#1E90FF"
    }
}

응답 정보

필드 데이터 타입 설명
id Integer 거래내역 id
amount Integer 거래금액
place string 거래내역 내용
date date format 거래일
memo string 거래내역 메모
category object 수입 카테고리
account object 결제수단 카테고리

4.3 결제 내역 SMS/MMS 파싱

메서드 요청 URI description
POST api/transactions/text-parsing 결제 내역 SMS/MMS 내용을 적절하게 파싱

요청 (Request)

요청문 예시

localhost:5000/api/transactions/text-parsing

body

{ 
    "text": "[Web발신]\n우리(1234) 체크승인\n홍*동님\n10,000원\n11/03 10:03\n스타벅스코리아"
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
text string Y - 파싱하고자 하는 결제 내역 문자 내용

응답 (Response)

응답 예시

{
    "transactionType": "승인",
    "isDeposit": false,
    "cardname": "우리",
    "amount": 10000,
    "date": "11/03",
    "time": "10:03"
}

응답 정보

필드 데이터 타입 설명
transactionType string 거래 타입\n- "승인" : 정상적인 지출 결제 내역\n- "취소" : 정상적인 수입 결제 내역\n - "거절": 처리할 수 없는 결제 내역
isDeposit boolean 수입인지 여부\n- true: 수입\n- false: 지출
cardname string 결제수단 이름
amount Interger 금액
date string 거래가 발생한 날짜
time string 거래가 발생한 시각

4.4 가계부 수입 지출 내역 조회

메서드 요청 URI description
GET api/transacions?accountbook_id&start_date&end_date 수입 거래내역 생성

요청 (Request)

요청문 예시

localhost:5000/api/transactions?accountbook_id=1&start_date=2020.11.01&end_date=2020.12.31

응답 (Response)

응답 예시

[
    {
        "id": 1,
        "amount": 7500,
        "place": "맘스터치",
        "date": "2020-11-30T15:00:00.000Z",
        "memo": null,
        "category": {
            "id": 3,
            "name": "경조사",
            "color": "red"
        },
        "account": {
            "id": 1,
            "name": "삼성카드",
            "color": "tomato"
        }
    }
]

응답 정보

필드 데이터 타입 설명
id Integer 거래내역 id
amount Integer 거래금액
place string 거래내역 내용
date date format 거래일
memo string 거래내역 메모
category object 수입 카테고리
account object 결제수단 카테고리

4.5 가계부 내 특정 수입 내역 수정

메서드 요청 URI description
PATCH api/transactions/income/:income_id 수입 거래내역 수정

요청 (Request)

요청문 예시

localhost:5000/api/transactions/income/28

body

{
    "incomeCategoryId":2,
    "accountId":2, 
    "amount":50000, 
    "content":"안녕하세!요", 
    "date":"2020-12-04T00:11:00.000Z", 
    "memo":"반갑습니다."
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
incomeCategoryId Integer Y - 수입 카테고리 id
accountId Integer Y - 결제수단 Id
amount Integer Y - 거래금액
content string Y - 거래내역 내용
date date format Y - 거래일
memo string N - 거래내역 메모

응답 (Response)

응답 예시

{
    "id": 28,
    "amount": 50000,
    "content": "안녕하세!요",
    "date": "2020-12-04T00:11:00.000Z",
    "memo": "반갑습니다.",
    "category": {
        "id": 2,
        "name": "중고판매",
        "color": "dodgerblue"
    },
    "account": {
        "id": 2,
        "name": "국민카드",
        "color": "dodgerblue"
    }
}

응답 정보

필드 데이터 타입 설명
id Integer 거래내역 id
amount Integer 거래금액
content string 거래내역 내용
date date format 거래일
memo string 거래내역 메모
category object 수입 카테고리
account object 결제수단 카테고리

4.6 가계부 내 특정 지출 내역 수정

메서드 요청 URI description
PATCH api/transactions/expenditure/:expenditure_id 지출 거래내역 수정

요청 (Request)

요청문 예시

localhost:5000/api/transactions/expenditure/1

body

{
    "expenditureCategoryId":1,
    "accountId":2, 
    "amount":50000, 
    "content":"안녕하세!요", 
    "date":"2020-12-04T00:11:00.000Z", 
    "memo":"반갑습니다."
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
expenditureCategoryId Integer Y - 지출 카테고리 id
accountId Integer Y - 결제수단 Id
amount Integer Y - 거래금액
place string Y - 거래내역 내용
date date format Y - 거래일
memo string N - 거래내역 메모

응답 (Response)

응답 예시

{
    "id": 1,
    "amount": 50000,
    "place": "맘스터치",
    "date": "2020-12-04T00:11:00.000Z",
    "memo": "반갑습니다.",
    "category": {
        "id": 1,
        "name": "식사",
        "color": "tomato"
    },
    "account": {
        "id": 2,
        "name": "국민카드",
        "color": "dodgerblue"
    }
}

응답 정보

필드 데이터 타입 설명
id Integer 거래내역 id
amount Integer 거래금액
place string 거래내역 내용
date date format 거래일
memo string 거래내역 메모
category object 수입 카테고리
account object 결제수단 카테고리

4.7 가계부 내 특정 지출 내역 삭제

메서드 요청 URI description
DELETE api/transactions/expenditure/:expenditure_id 지출 거래내역 삭제

요청 (Request)

요청문 예시

localhost:5000/api/transactions/expenditure/1

응답 (Response)

  • 정상적으로 삭제했을 경우 204 status 204
  • 완전삭제가아니라 deleted_at 값이 추가됨

4.8 가계부 내 특정 수입 내역 삭제

메서드 요청 URI description
DELETE api/transactions/income/:income_id 수입 거래내역 삭제

요청 (Request)

요청문 예시

localhost:5000/api/transactions/income/1

응답 (Response)

  • 정상적으로 삭제했을 경우 204 status 204
  • 완전 삭제가 아니라 deleted_at 값이 추가됨

5. 카테고리 (Category)

5.1 수입 카테고리 생성

메서드 요청 URI description
POST api/categories/income 수입 카테고리 생성

요청 (Request)

요청문 예시

localhost:5000/api/categories/income

body

{ 
    "accountbookId":1, 
    "color": "#000000"
    "name": "안녕"
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
accountbookId Integer Y - 가계부 id
color string Y - 색상
name string Y - 이름

응답 (Response)

응답 예시

{
  id: 7,
  name: '안녕',
  color: '#000000',
}

응답 정보

필드 데이터 타입 설명
id Integer 수입 카테고리 id
color string Y
name string Y

5.2 지출 카테고리 생성

메서드 요청 URI description
POST api/categories/expenditure 지출 카테고리 생성

요청 (Request)

요청문 예시

localhost:5000/api/expenditure/income

body

{ 
    "accountbookId":1, 
    "color": "#000000"
    "name": "안녕"
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
accountbookId Integer Y - 가계부 id
color string Y - 색상
name string Y - 이름

응답 (Response)

응답 예시

{
  id: 7,
  name: '안녕',
  color: '#000000',
}

응답 정보

필드 데이터 타입 설명
id Integer 지출 카테고리 id
color string Y
name string Y

5.3 수입 카테고리 조회

메서드 요청 URI description
GET api/categories/income/?accountbook_id 수입 카테고리 조회

요청 (Request)

요청문 예시

localhost:5000/api/categories/income?accountbook_id=1

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
accountbook_id Integer Y - 조회하고자 하는 가계부 고유 식별 번호

응답 (Response)

응답 예시

[
    {
        "id": 1,
        "name": "타행이체",
        "color": "tomato"
    },
    {
        "id": 2,
        "name": "중고판매",
        "color": "dodgerblue"
    },
    {
        "id": 3,
        "name": "급여",
        "color": "red"
    },
    ...
]

응답 정보

필드 데이터 타입 설명
id Integer 해당 가계부 내에 존재하는 수입 카테고리 고유 식별 번호
name String 해당 가계부 내에 존재하는 수입 카테고리 이름
color String 해당 가계부 내에 존재하는 수입 카테고리 라벨의 색상

5.4 지출 카테고리 조회

메서드 요청 URI description
GET api/categories/expenditure/?accountbook_id 가계부에 속한 지출 카테고리 조회

요청 (Request)

요청문 예시

localhost:5000/api/categories/expenditure?accountbook_id=1

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
accountbook_id Integer Y - 조회하고자 하는 가계부 고유 식별 번호

응답 (Response)

응답 예시

[
    {
        "id": 1,
        "name": "식사",
        "color": "tomato"
    },
    {
        "id": 2,
        "name": "생활",
        "color": "dodgerblue"
    },
    {
        "id": 3,
        "name": "경조사",
        "color": "red"
    },
    {
        "id": 4,
        "name": "교육",
        "color": "green"
    }
]

응답 정보

필드 데이터 타입 설명
id Integer 해당 가계부 내에 존재하는 지출 카테고리 고유 식별 번호
name String 해당 가계부 내에 존재하는 지출 카테고리 이름
color String 해당 가계부 내에 존재하는 지출 카테고리 라벨의 색상

5.5 수입 카테고리 수정

메서드 요청 URI description
PATCH api/categories/income/:income_category_id 수입 카테고리 수정

요청 (Request)

요청문 예시

localhost:5000/api/categories/income/7

body

{ 
    "color": "#000000"
    "name": "안녕"
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
color string Y - 색상
name string Y - 이름

응답 (Response)

응답 예시

{
  id: 7,
  name: '안녕',
  color: '#000000',
}

응답 정보

필드 데이터 타입 설명
id Integer 수입 카테고리 id
color string Y
name string Y

5.6 지출 카테고리 수정

메서드 요청 URI description
PATCH api/categories/expenditure/:expenditure_category_id 지출 카테고리 수정

요청 (Request)

요청문 예시

localhost:5000/api/categories/expenditure/7

body

{ 
    "color": "#000000"
    "name": "안녕"
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
color string Y - 색상
name string Y - 이름

응답 (Response)

응답 예시

{
  id: 7,
  name: '안녕',
  color: '#000000',
}

응답 정보

필드 데이터 타입 설명
id Integer 지출 카테고리 id
color string Y
name string Y

5.7 수입 카테고리 삭제

메서드 요청 URI description
DELETE api/categories/income/:income_category_id 수입 카테고리 삭제

요청 (Request)

요청문 예시

localhost:5000/api/categories/income/1

응답 (Response)

  • 삭제 성공 시 204 status 응답

5.8 지출 카테고리 삭제

메서드 요청 URI description
DELETE api/categories/expenditure/:expenditure_category_id 지출 카테고리 삭제

요청 (Request)

요청문 예시

localhost:5000/api/categories/expenditure/1

응답 (Response)

  • 삭제 성공 시 204 status 응답

6. 계좌/결제수단 (Account)

6.1 새로운 계좌(결제수단) 생성

메서드 요청 URI description
POST api/accounts 새로운 계좌(결제수단) 생성

요청 (Request)

요청문 예시

localhost:5000/api/accounts

body

{ 
    "accountbookId":1, 
    "color": "#000000"
    "name": "안녕"
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
accountbookId Integer Y - 가계부 id
color string Y - 색상
name string Y - 이름

응답 (Response)

응답 예시

{
  id: 7,
  name: '안녕',
  color: '#000000',
}

응답 정보

필드 데이터 타입 설명
id Integer 수입 카테고리 id
color string Y
name string Y

6.2 계좌(결제수단) 목록 조회

메서드 요청 URI description
GET api/accounts/?accountbook_id 계좌(결제수단) 목록 조회

요청 (Request)

요청문 예시

localhost:5000/api/accounts?accountbook_id=1

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
accountbook_id Integer Y - 조회하고자 하는 가계부 고유 식별 번호

응답 (Response)

응답 예시

[
    {
        "id": 1,
        "name": "삼성카드",
        "color": "tomato"
    },
    {
        "id": 2,
        "name": "국민카드",
        "color": "dodgerblue"
    },
    {
        "id": 3,
        "name": "농협카드",
        "color": "red"
    },
    {
        "id": 4,
        "name": "우리카드",
        "color": "blue"
    },
    {
        "id": 5,
        "name": "신한카드",
        "color": "green"
    }
]

응답 정보

필드 데이터 타입 설명
id Integer 해당 가계부 내에 존재하는 결제수단 고유 식별 번호
name String 해당 가계부 내에 존재하는 결제수단 이름
color String 해당 가계부 내에 존재하는 결제수단 라벨의 색상

6.3 계좌(결제수단) 수정

메서드 요청 URI description
PATCH api/accounts/:account_id 계좌(결제수단) 목록 조회

요청 (Request)

요청문 예시

localhost:5000/api/accounts/7

body

{ 
    "color": "#000000"
    "name": "안녕"
}

요청 변수 정보

요청 변수명 데이터 타입 필수 여부 기본값 설명
color string Y - 색상
name string Y - 이름

응답 (Response)

응답 예시

{
  id: 7,
  name: '안녕',
  color: '#000000',
}

응답 정보

필드 데이터 타입 설명
id Integer 계좌(결제수단) id
color string Y
name string Y

6.4 계좌(결제수단) 삭제

메서드 요청 URI description
DELETE api/accounts/:account_id 계좌(결제수단) 삭제

요청 (Request)

요청문 예시

localhost:5000/api/accounts/1

응답 (Response)

  • 삭제 성공 시 204 status 응답
Clone this wiki locally