응답 코드

Code Message Description

200

SUCCESS

성공

400

BAD_REQUEST

잘못된 요청

잔액 API

잔액 조회

HTTP Request

GET /api/v1/users/1/balance HTTP/1.1
Host: localhost:8080
Table 1. /api/v1/users/{id}/balance
Parameter Description

id

사용자 ID

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 76

{
  "code" : 200,
  "message" : "OK",
  "data" : {
    "amount" : 1000
  }
}

Response Fields

Path Type Optional Description

code

Number

응답 코드

message

String

응답 메세지

data

Object

응답 데이터

data.amount

Number

잔액

잔액 충전

HTTP Request

POST /api/v1/users/1/balance HTTP/1.1
Content-Type: application/json
Content-Length: 22
Host: localhost:8080

{
  "amount" : 10000
}
Table 2. /api/v1/users/{id}/balance
Parameter Description

id

사용자 ID

Request Fields

Path Type Optional Description

amount

Number

충전 금액

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 38

{
  "code" : 200,
  "message" : "OK"
}

Response Fields

Path Type Optional Description

code

Number

응답 코드

message

String

응답 메세지

쿠폰 API

보유 쿠폰 목록 조회

HTTP Request

GET /api/v1/users/1/coupons HTTP/1.1
Host: localhost:8080
Table 3. /api/v1/users/{id}/coupons
Parameter Description

id

사용자 ID

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 198

{
  "code" : 200,
  "message" : "OK",
  "data" : {
    "coupons" : [ {
      "id" : 1,
      "name" : "쿠폰명",
      "discountRate" : 0.1,
      "expiredAt" : "2025-04-01 12:00:00"
    } ]
  }
}

Response Fields

Path Type Optional Description

code

Number

응답 코드

message

String

응답 메세지

data

Object

응답 데이터

data.coupons[]

Array

쿠폰 목록

data.coupons[].id

Number

쿠폰 ID

data.coupons[].name

String

쿠폰 이름

data.coupons[].discountRate

Number

쿠폰 할인율

data.coupons[].expiredAt

String

쿠폰 만료일

쿠폰 발급

HTTP Request

POST /api/v1/users/1/coupons HTTP/1.1
Content-Type: application/json
Content-Length: 20
Host: localhost:8080

{
  "couponId" : 1
}
Table 4. /api/v1/users/{id}/coupons
Parameter Description

id

사용자 ID

Request Fields

Path Type Optional Description

couponId

Number

쿠폰 ID

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 38

{
  "code" : 200,
  "message" : "OK"
}

Response Fields

Path Type Optional Description

code

Number

응답 코드

message

String

응답 메세지

주문/결제 API

주문 결제 완료

HTTP Request

POST /api/v1/orders HTTP/1.1
Content-Type: application/json
Content-Length: 95
Host: localhost:8080

{
  "userId" : 1,
  "couponId" : 1,
  "products" : [ {
    "id" : 1,
    "quantity" : 2
  } ]
}

Request Fields

Path Type Optional Description

userId

Number

사용자 ID

couponId

Number

O

쿠푠 ID

products[].id

Number

상품 ID

products[].quantity

Number

상품 수량

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 38

{
  "code" : 200,
  "message" : "OK"
}

Response Fields

Path Type Optional Description

code

Number

응답 코드

message

String

응답 메세지

상품 API

상품 목록 조회

HTTP Request

GET /api/v1/products HTTP/1.1
Host: localhost:8080

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 171

{
  "code" : 200,
  "message" : "OK",
  "data" : {
    "products" : [ {
      "id" : 1,
      "name" : "상품명",
      "price" : 300000,
      "stock" : 3
    } ]
  }
}

Response Fields

Path Type Optional Description

code

Number

응답 코드

message

String

응답 메세지

data

Object

응답 데이터

data.products[]

Array

상품 목록

data.products[].id

Number

상품 ID

data.products[].name

String

상품 이름

data.products[].price

Number

가격

data.products[].stock

Number

재고 수

랭킹 API

상위 상품 Top5 목록 조회

HTTP Request

GET /api/v1/products/ranks HTTP/1.1
Host: localhost:8080

HTTP Response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 171

{
  "code" : 200,
  "message" : "OK",
  "data" : {
    "products" : [ {
      "id" : 1,
      "name" : "상품명",
      "price" : 300000,
      "stock" : 3
    } ]
  }
}

Response Fields

Path Type Optional Description

code

Number

응답 코드

message

String

응답 메세지

data

Object

응답 데이터

data.products[]

Array

상품 목록

data.products[].id

Number

상품 ID

data.products[].name

String

상품 이름

data.products[].price

Number

가격

data.products[].stock

Number

재고 수