HTTP 동사

본 REST API에서 사용하는 HTTP 동사(verbs)는 가능한한 표준 HTTP와 REST 규약을 따릅니다.

동사 용례

GET

리소스를 가져올 때 사용

POST

새 리소스를 만들 때 사용

PUT

기존 리소스를 수정할 때 사용

PATCH

기존 리소스의 일부를 수정할 때 사용

DELETE

기존 리소스를 삭제할 떄 사용

HTTP 상태 코드

본 REST API에서 사용하는 HTTP 상태 코드는 가능한 표준 HTTP와 REST 규약을 따릅니다.

상태 코드 용례

200 OK

요청을 성공적으로 처리함

201 Created

새 리소스를 성공적으로 생성함. 응답의 Location 헤더에 해당 리소스의 URI가 담겨있다.

204 No Content

기존 리소스를 성공적으로 수정함.

400 Bad Request

잘못된 요청을 보낸 경우. 응답 본문에 더 오류에 대한 정보가 담겨있다.

404 Not Found

요청한 리소스가 없음.

409 Conflict

클라이언트의 요청이 서버의 상태와 충돌이 발생한 경우.

주문

주문 수정

Curl request

$ curl 'http://http://just-pickup.com:8001/order/1' -i -X PATCH \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -H 'Accept: application/json' \
    -d '{
  "orderStatus" : "PLACED"
}'

HTTP request

PATCH //just-pickup.com:8001/order/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: application/json
Content-Length: 30
Host: http

{
  "orderStatus" : "PLACED"
}

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : null
}

Path parameters

Table 1. /order/{orderId}
Parameter Description

orderId

주문 고유번호

Request fields

Path Type Description

orderStatus

String

주문 상태

Response fields

Path Type Description

code

String

결과코드 SUCCESS/ERROR

message

String

메시지

data

Null

데이터

주문 상세보기 조회

Curl request

$ curl 'http://http://just-pickup.com:8001/api/order-detail/1589' -i -X GET

HTTP request

GET //just-pickup.com:8001/api/order-detail/1589 HTTP/1.1
Host: http

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : {
    "id" : 1589,
    "orderStatus" : "PLACED",
    "orderTime" : "2022-03-29 14:05",
    "orderPrice" : 76600,
    "storeName" : "매장이름",
    "user" : {
      "id" : 6,
      "name" : "박상범",
      "phoneNumber" : "010-1234-5678"
    },
    "orderItems" : [ {
      "id" : 11374,
      "itemId" : 43,
      "totalPrice" : 0,
      "count" : 2,
      "name" : "카페라떼",
      "options" : [ {
        "id" : 11372,
        "itemOptionId" : 41,
        "name" : "HOT",
        "optionType" : "REQUIRED"
      }, {
        "id" : 11373,
        "itemOptionId" : 42,
        "name" : "시럽 추가",
        "optionType" : "OTHER"
      } ]
    }, {
      "id" : 11375,
      "itemId" : 44,
      "totalPrice" : 0,
      "count" : 2,
      "name" : "아메리카노",
      "options" : [ {
        "id" : 11371,
        "itemOptionId" : 40,
        "name" : "ICE",
        "optionType" : "REQUIRED"
      } ]
    } ]
  }
}

Path parameters

Table 1. /api/order-detail/{orderId}
Parameter Description

orderId

주문 고유번호

Response fields

Path Type Description

code

String

결과코드 SUCCESS/ERROR

message

String

메세지

data.id

Number

주문 고유번호

data.storeName

String

주문 매장이름

data.orderStatus

String

주문 상태

data.orderTime

String

주문 시간 [yyy-MM-dd]

data.orderPrice

Number

주문 금액

data.user.id

Number

주문한 회원 고유번호

data.user.name

String

주문한 회원 이름

data.user.phoneNumber

String

주문한 회원 전화번호

data.orderItems[*].id

Number

주문아이템 고유번호

data.orderItems[*].itemId

Number

아이템 고유번호

data.orderItems[*].totalPrice

Number

주문아이템 총합계

data.orderItems[*].count

Number

주문아이템 수량

data.orderItems[*].name

String

아이템 이름

data.orderItems[*].options[*].id

Number

주문아이템옵션 고유번호

data.orderItems[*].options[*].itemOptionId

Number

아이템옵션 고유번호

data.orderItems[*].options[*].name

String

아이템옵션 이름

data.orderItems[*].options[*].optionType

String

아이템옵션 타입

주문 (사용자 서비스)

주문 내역 조회

Curl request

$ curl 'http://http://just-pickup.com:8001/api/customer/order/history?page=0' -i -X GET \
    -H 'user-id: 2'

HTTP request

GET //just-pickup.com:8001/api/customer/order/history?page=0 HTTP/1.1
user-id: 2
Host: http

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : {
    "orders" : [ {
      "orderId" : 1,
      "orderTime" : "2022-03-07 19:00",
      "orderStatus" : "PLACED",
      "storeId" : 1001,
      "storeName" : null,
      "orderPrice" : 10000,
      "orderItems" : [ {
        "orderItemId" : 100,
        "orderItemName" : null
      }, {
        "orderItemId" : 400,
        "orderItemName" : null
      } ]
    }, {
      "orderId" : 2,
      "orderTime" : "2022-03-07 19:00",
      "orderStatus" : "PLACED",
      "storeId" : 1002,
      "storeName" : null,
      "orderPrice" : 20000,
      "orderItems" : [ {
        "orderItemId" : 200,
        "orderItemName" : null
      }, {
        "orderItemId" : 600,
        "orderItemName" : null
      } ]
    }, {
      "orderId" : 3,
      "orderTime" : "2022-03-07 19:00",
      "orderStatus" : "PLACED",
      "storeId" : 1003,
      "storeName" : null,
      "orderPrice" : 30000,
      "orderItems" : [ {
        "orderItemId" : 300,
        "orderItemName" : null
      }, {
        "orderItemId" : 800,
        "orderItemName" : null
      } ]
    } ],
    "hasNext" : true
  }
}

Request headers

Name Description

user-id

유저 고유번호

Request parameters

Parameter Description

page

검색할 페이지 [Optional, default: 0]

size

검색할 페이지 사이즈 [Optional, default: 3]

Response fields

Path Type Description

code

String

결과 코드 SUCCESS/ERROR

message

String

메시지

data.orders[*].orderId

Number

주문 고유번호

data.orders[*].orderTime

String

주문 시간 [yyyy-MM-dd HH:mm]

data.orders[*].orderPrice

Number

합계

data.orders[*].orderStatus

String

주문 상태

data.orders[*].storeId

Number

매장 고유번호

data.orders[*].storeName

Null

매장 이름

data.orders[*].orderItems[*].orderItemId

Number

주문 아이템 고유번호

data.orders[*].orderItems[*].orderItemName

Null

주문 아이템 이름

data.hasNext

Boolean

더보기 버튼 유무

장바구니 상품 추가

Curl request

$ curl 'http://http://just-pickup.com:8001/api/customer/order/item' -i -X POST \
    -H 'Content-Type: application/json;charset=UTF-8' \
    -H 'user-id: 2' \
    -H 'Accept: application/json' \
    -d '{
  "itemId" : 102,
  "storeId" : 1,
  "price" : 3000,
  "count" : 4,
  "itemOptionIds" : [ 1, 2, 3, 4, 5 ]
}'

HTTP request

POST //just-pickup.com:8001/api/customer/order/item HTTP/1.1
Content-Type: application/json;charset=UTF-8
user-id: 2
Accept: application/json
Content-Length: 109
Host: http

{
  "itemId" : 102,
  "storeId" : 1,
  "price" : 3000,
  "count" : 4,
  "itemOptionIds" : [ 1, 2, 3, 4, 5 ]
}

HTTP response

HTTP/1.1 204 No Content
Content-Type: application/json
Content-Length: 59

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : null
}

Request headers

Name Description

user-id

유저 고유번호

Request body

{
  "itemId" : 102,
  "storeId" : 1,
  "price" : 3000,
  "count" : 4,
  "itemOptionIds" : [ 1, 2, 3, 4, 5 ]
}

Request fields

Path Type Description

itemId

Number

아이템 고유번호

storeId

Number

매장 고유번호

price

Number

아이템 가격

count

Number

아이템 갯수

itemOptionIds

Array

아이템 옵션들

장바구니 내역 조회

Curl request

$ curl 'http://http://just-pickup.com:8001/api/customer/order/orders' -i -X GET \
    -H 'user-id: 2'

HTTP request

GET //just-pickup.com:8001/api/customer/order/orders HTTP/1.1
user-id: 2
Host: http

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : {
    "id" : 2,
    "userId" : 2,
    "orderPrice" : 12000,
    "storeName" : "저스트카페",
    "orderItemDtoList" : [ {
      "id" : 1,
      "itemId" : 1,
      "itemName" : "카페라테",
      "orderItemOptionDtoList" : [ {
        "id" : 2,
        "optionType" : "REQUIRED",
        "name" : "Hot"
      }, {
        "id" : 2,
        "optionType" : "OTHER",
        "name" : "샷추카"
      } ],
      "price" : 3000,
      "count" : 32
    } ]
  }
}

Request headers

Name Description

user-id

유저 고유번호

Response fields

Path Type Description

code

String

결과 코드 SUCCESS/ERROR

message

String

메시지

data.id

Number

주문 고유번호

data.userId

Number

주문한 유저 고유번호

data.storeName

String

매장 명

data.orderPrice

Number

총 합계

data.orderItemDtoList[*].id

Number

orderItem 고유번호

data.orderItemDtoList[*].itemId

Number

상품 고유번호

data.orderItemDtoList[*].itemName

String

상품 명

data.orderItemDtoList[*].orderItemOptionDtoList[*]

Array

아이템 옵션들

data.orderItemDtoList[*].orderItemOptionDtoList[*].id

Number

아이템 옵션 고유번호

data.orderItemDtoList[*].orderItemOptionDtoList[*].optionType

String

아이템 옵션 타입

data.orderItemDtoList[*].orderItemOptionDtoList[*].name

String

아이템 옵션명

data.orderItemDtoList[*].price

Number

상품 가격

data.orderItemDtoList[*].count

Number

상품 갯수

주문 생성

Curl request

$ curl 'http://http://just-pickup.com:8001/api/customer/order/orders' -i -X POST \
    -H 'user-id: 2'

HTTP request

POST //just-pickup.com:8001/api/customer/order/orders HTTP/1.1
user-id: 2
Host: http

HTTP response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 59

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : null
}

Request headers

Name Description

user-id

유저 고유번호

주문 (점주 서비스)

주문 페이지 조회

Curl request

$ curl 'http://http://just-pickup.com:8001/api/owner/order/order-main?orderDate=2022-02-03&lastOrderId=7' -i -X GET \
    -H 'user-id: 1'

HTTP request

GET //just-pickup.com:8001/api/owner/order/order-main?orderDate=2022-02-03&lastOrderId=7 HTTP/1.1
user-id: 1
Host: http

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : {
    "hasNext" : true,
    "orders" : [ {
      "id" : 1,
      "orderTime" : "2022-03-29 14:05",
      "orderStatus" : "ACCEPTED",
      "userName" : null,
      "storeName" : "가게명1",
      "orderItems" : [ {
        "itemName" : "아이템10"
      }, {
        "itemName" : "아이템11"
      }, {
        "itemName" : "아이템12"
      } ]
    }, {
      "id" : 2,
      "orderTime" : "2022-03-29 14:05",
      "orderStatus" : "ACCEPTED",
      "userName" : null,
      "storeName" : "가게명2",
      "orderItems" : [ {
        "itemName" : "아이템20"
      }, {
        "itemName" : "아이템22"
      }, {
        "itemName" : "아이템24"
      } ]
    }, {
      "id" : 3,
      "orderTime" : "2022-03-29 14:05",
      "orderStatus" : "ACCEPTED",
      "userName" : null,
      "storeName" : "가게명3",
      "orderItems" : [ {
        "itemName" : "아이템30"
      }, {
        "itemName" : "아이템33"
      }, {
        "itemName" : "아이템36"
      } ]
    }, {
      "id" : 4,
      "orderTime" : "2022-03-29 14:05",
      "orderStatus" : "ACCEPTED",
      "userName" : null,
      "storeName" : "가게명4",
      "orderItems" : [ {
        "itemName" : "아이템40"
      }, {
        "itemName" : "아이템44"
      }, {
        "itemName" : "아이템48"
      } ]
    }, {
      "id" : 5,
      "orderTime" : "2022-03-29 14:05",
      "orderStatus" : "ACCEPTED",
      "userName" : null,
      "storeName" : "가게명5",
      "orderItems" : [ {
        "itemName" : "아이템50"
      }, {
        "itemName" : "아이템55"
      }, {
        "itemName" : "아이템60"
      } ]
    }, {
      "id" : 6,
      "orderTime" : "2022-03-29 14:05",
      "orderStatus" : "ACCEPTED",
      "userName" : null,
      "storeName" : "가게명6",
      "orderItems" : [ {
        "itemName" : "아이템60"
      }, {
        "itemName" : "아이템66"
      }, {
        "itemName" : "아이템72"
      } ]
    } ]
  }
}

Request headers

Name Description

user-id

유저 고유번호

Request parameters

Parameter Description

orderDate

주문 날짜 YYYY-MM-DD

lastOrderId

페이지의 마지막 주문 고유 번호

Response fields

Path Type Description

code

String

결과 코드 SUCCESS/ERROR

message

String

메시지

data.hasNext

Boolean

다음 게시물 표시 여부

data.orders[*].id

Number

주문 고유번호

data.orders[*].orderTime

String

주문 시간 [yyyy-MM-dd HH:mm]

data.orders[*].orderStatus

String

주문 상태

data.orders[*].userName

Null

주문한 사용자 이름

data.orders[*].storeName

String

가게 이름

data.orders[*].orderItems[*].itemName

String

아이템 이름

주문 페이지 조회 (잘못된 파라미터 형식)

Curl request

$ curl 'http://http://just-pickup.com:8001/api/owner/order/prev-order?startDate=2023-02-03&endDate=2022-02-04&page=0' -i -X GET \
    -H 'user-id: 1'

HTTP request

GET //just-pickup.com:8001/api/owner/order/prev-order?startDate=2023-02-03&endDate=2022-02-04&page=0 HTTP/1.1
user-id: 1
Host: http

HTTP response

HTTP/1.1 400 Bad Request
Content-Type: application/json
Content-Length: 155

{
  "code" : "ERROR",
  "message" : "[startDate](은)는 시작일은 종료일보다 클 수 없습니다. 입력된 값: [2023-02-03]",
  "data" : null
}

Request headers

Name Description

user-id

유저 고유번호

Request parameters

Parameter Description

startDate

시작날짜 YYYY-MM-DD

endDate

종료날짜 YYYY-MM-DD

page

검색 페이지 (0부터 시작)

Response fields

Path Type Description

code

String

결과 코드 SUCCESS/ERROR

message

String

메시지

data

Null

데이터

지난 주문 페이지 조회

Curl request

$ curl 'http://http://just-pickup.com:8001/api/owner/order/prev-order?startDate=2022-02-03&endDate=2022-02-04&page=0' -i -X GET \
    -H 'user-id: 1'

HTTP request

GET //just-pickup.com:8001/api/owner/order/prev-order?startDate=2022-02-03&endDate=2022-02-04&page=0 HTTP/1.1
user-id: 1
Host: http

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : {
    "orders" : [ {
      "orderId" : 1,
      "orderStatus" : "PLACED",
      "orderTime" : "2022-02-03 14:00:00",
      "orderPrice" : 0,
      "userName" : "닉네임",
      "orderItems" : [ {
        "orderItemId" : 100,
        "orderItemName" : "아이템1"
      }, {
        "orderItemId" : 101,
        "orderItemName" : "아이템2"
      } ]
    }, {
      "orderId" : 2,
      "orderStatus" : "FAILED",
      "orderTime" : "2022-02-03 15:00:00",
      "orderPrice" : 0,
      "userName" : "닉네임",
      "orderItems" : [ {
        "orderItemId" : 102,
        "orderItemName" : "아이템3"
      }, {
        "orderItemId" : 103,
        "orderItemName" : "아이템2"
      } ]
    } ],
    "page" : {
      "startPage" : 0,
      "totalPage" : 1
    }
  }
}

Request headers

Name Description

user-id

유저 고유번호

Request parameters

Parameter Description

startDate

시작날짜 YYYY-MM-DD

endDate

종료날짜 YYYY-MM-DD

page

검색 페이지 (0부터 시작)

Response fields

Path Type Description

code

String

결과 코드 SUCCESS/ERROR

message

String

메시지

data.orders[*].orderId

Number

주문 고유번호

data.orders[*].orderStatus

String

주문상태

data.orders[*].orderTime

String

주문시간

data.orders[*].orderPrice

Number

결제금액

data.orders[*].userName

String

닉네임

data.orders[*].orderItems[*].orderItemId

Number

주문상품 고유번호

data.orders[*].orderItems[*].orderItemName

String

주문상품 이름

data.page.startPage

Number

현재 페이지 (0부터 시작)

data.page.totalPage

Number

총 페이지 개수

지난 주문 페이지 조회 (파라미터 오류)

Curl request

$ curl 'http://http://just-pickup.com:8001/api/owner/order/prev-order?startDate=2023-02-03&endDate=2022-02-04&page=0' -i -X GET \
    -H 'user-id: 1'

HTTP request

GET //just-pickup.com:8001/api/owner/order/prev-order?startDate=2023-02-03&endDate=2022-02-04&page=0 HTTP/1.1
user-id: 1
Host: http

HTTP response

HTTP/1.1 400 Bad Request
Content-Type: application/json
Content-Length: 155

{
  "code" : "ERROR",
  "message" : "[startDate](은)는 시작일은 종료일보다 클 수 없습니다. 입력된 값: [2023-02-03]",
  "data" : null
}

Request headers

Name Description

user-id

유저 고유번호

Request parameters

Parameter Description

startDate

시작날짜 YYYY-MM-DD

endDate

종료날짜 YYYY-MM-DD

page

검색 페이지 (0부터 시작)

Response fields

Path Type Description

code

String

결과 코드 SUCCESS/ERROR

message

String

메시지

data

Null

데이터

대쉬보드 조회

Curl request

$ curl 'http://http://just-pickup.com:8001/api/owner/order/dashboard' -i -X GET \
    -H 'user-id: 1'

HTTP request

GET //just-pickup.com:8001/api/owner/order/dashboard HTTP/1.1
user-id: 1
Host: http

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : {
    "salesAmount" : 1237801239,
    "bestSellItem" : {
      "itemId" : 40,
      "itemName" : "까메리카노",
      "sumCounts" : 3217
    },
    "sellAmountAWeeks" : [ {
      "sellDate" : "2022-03-22",
      "sellAmount" : 1235
    }, {
      "sellDate" : "2022-03-23",
      "sellAmount" : 235
    }, {
      "sellDate" : "2022-03-24",
      "sellAmount" : 2235
    }, {
      "sellDate" : "2022-03-25",
      "sellAmount" : 1635
    }, {
      "sellDate" : "2022-03-26",
      "sellAmount" : 35
    }, {
      "sellDate" : "2022-03-27",
      "sellAmount" : 635
    } ]
  }
}

Request headers

Name Description

user-id

유저 고유번호

Response fields

Path Type Description

code

String

결과 코드 SUCCESS/ERROR

message

String

메시지

data

Object

데이터

data.salesAmount

Number

총 판매금약

data.bestSellItem

Object

7일간 베스트 판매 상품

data.bestSellItem.itemId

Number

7일간 베스트 판매 상품 고유번호

data.bestSellItem.itemName

String

7일간 베스트 판매 상품명

data.bestSellItem.sumCounts

Number

7일간 베스트 판매 상품판매량

data.sellAmountAWeeks

Array

7일간 판매 통계

data.sellAmountAWeeks[*].sellDate

String

7일간 판매 통계날짜

data.sellAmountAWeeks[*].sellAmount

Number

7일간 판매 통계날짜별 판매량

주문상품 (사용자 서비스)

장바구니 아이템 삭제

Curl request

$ curl 'http://http://just-pickup.com:8001/api/customer/orderItem/2' -i -X DELETE \
    -H 'user-id: 2'

HTTP request

DELETE //just-pickup.com:8001/api/customer/orderItem/2 HTTP/1.1
user-id: 2
Host: http

HTTP response

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

{
  "code" : "SUCCESS",
  "message" : "",
  "data" : 2
}

Request headers

Name Description

user-id

유저 고유번호

Path parameters

Table 1. /api/customer/orderItem/{orderItemId}
Parameter Description

orderItemId

orderItem 고유번호

Response fields

Path Type Description

code

String

결과 코드 SUCCESS/ERROR

message

String

메시지

data

Number

orderItem 고유번호