장바구니 단건 조회
Request
CURL
$ curl 'https://localhost:8443/api/carts/1/1' -i -X GET \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Accept: */*'
HTTPie
$ http GET 'https://localhost:8443/api/carts/1/1' \
'Content-Type:application/json;charset=UTF-8' \
'Accept:*/*'
Request HTTP Example
GET /api/carts/1/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: */*
Host: localhost:8443
Response
Response Fields
필드 | 타입 | 필수값 | 설명 | 제한 |
---|---|---|---|---|
id |
Number |
true |
장바구니 고유 번호 |
|
quantity |
Number |
true |
주문 수량 |
|
memberResponse |
Object |
true |
주문 회원 |
|
productResponse |
Object |
true |
주문 상품 |
|
_links |
Varies |
true |
HATEOAS |
Response HTTP Example
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/hal+json
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Frame-Options: SAMEORIGIN
Content-Length: 918
{
"id" : 1,
"memberResponse" : {
"id" : 1,
"email" : "panda@naver.com",
"nickname" : "panda",
"profileImage" : null,
"phone" : null,
"license" : null,
"createdDateTime" : "2021-10-25T01:13:51.263301",
"lastModifiedDateTime" : "2021-10-25T01:13:51.263301",
"leaveDateTime" : null,
"authority" : null,
"address" : null,
"authProvider" : null,
"status" : "ACTIVE"
},
"productResponse" : {
"name" : "panda",
"description" : "nice bear",
"productImage" : null,
"memberResponse" : null,
"price" : 50000,
"stock" : 15000,
"createdDateTime" : "2021-10-25T01:13:51.266145",
"productCategory" : "MEAT",
"region" : "CHUNGCHEONGBUKDO"
},
"quantity" : 500,
"_links" : {
"self" : {
"href" : "https://localhost:8443/api/carts/1/1"
},
"cart-list" : {
"href" : "https://localhost:8443/api/carts/1"
}
}
}
장바구니 다건 조회
Request
CURL
$ curl 'https://localhost:8443/api/carts/1' -i -X GET \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Accept: */*'
HTTPie
$ http GET 'https://localhost:8443/api/carts/1' \
'Content-Type:application/json;charset=UTF-8' \
'Accept:*/*'
Request HTTP Example
GET /api/carts/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: */*
Host: localhost:8443
Response
Response Fields
필드 | 타입 | 필수값 | 설명 | 제한 |
---|---|---|---|---|
_embedded.cartResponseList[].id |
Number |
true |
장바구니 고유 번호 |
|
_embedded.cartResponseList[].quantity |
Number |
true |
주문 수량 |
|
_embedded.cartResponseList[].memberResponse |
Object |
true |
주문 회원 |
|
_embedded.cartResponseList[].productResponse |
Object |
true |
주문 상품 |
Response HTTP Example
HTTP/1.1 200 OK
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Content-Type: application/hal+json
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Frame-Options: SAMEORIGIN
Content-Length: 1122
{
"_embedded" : {
"cartResponseList" : [ {
"id" : 1,
"memberResponse" : {
"id" : 1,
"email" : "panda@naver.com",
"nickname" : "panda",
"profileImage" : null,
"phone" : null,
"license" : null,
"createdDateTime" : "2021-10-25T01:13:51.334818",
"lastModifiedDateTime" : "2021-10-25T01:13:51.334818",
"leaveDateTime" : null,
"authority" : null,
"address" : null,
"authProvider" : null,
"status" : "ACTIVE"
},
"productResponse" : {
"name" : "panda",
"description" : "nice bear",
"productImage" : null,
"memberResponse" : null,
"price" : 50000,
"stock" : 15000,
"createdDateTime" : "2021-10-25T01:13:51.337615",
"productCategory" : "MEAT",
"region" : "CHUNGCHEONGBUKDO"
},
"quantity" : 500
} ]
},
"_links" : {
"self" : {
"href" : "https://localhost:8443/api/carts/1?page=0&size=10"
}
},
"page" : {
"size" : 10,
"totalElements" : 1,
"totalPages" : 1,
"number" : 0
}
}
장바구니 추가
Request
CURL
$ curl 'https://localhost:8443/api/carts/1' -i -X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Accept: */*' \
-d '{
"memberId" : 1,
"productId" : 1,
"quantity" : 500
}'
HTTPie
$ echo '{
"memberId" : 1,
"productId" : 1,
"quantity" : 500
}' | http POST 'https://localhost:8443/api/carts/1' \
'Content-Type:application/json;charset=UTF-8' \
'Accept:*/*'
Request Fields
필드 | 타입 | 필수값 | 설명 | 제한 |
---|---|---|---|---|
memberId |
Number |
true |
주문 회원 고유 번호 |
Not Null |
productId |
Number |
true |
상품 고유 번호 |
Not Null |
quantity |
Number |
true |
주문 수량 |
Not Null |
Request HTTP Example
POST /api/carts/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: */*
Content-Length: 59
Host: localhost:8443
{
"memberId" : 1,
"productId" : 1,
"quantity" : 500
}
Response
Response HTTP Example
HTTP/1.1 201 Created
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
Location: https://localhost:8443/api/carts/1/2
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Frame-Options: SAMEORIGIN
장바구니 단건 삭제
Request
CURL
$ curl 'https://localhost:8443/api/carts/1/1' -i -X DELETE \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Accept: */*'
HTTPie
$ http DELETE 'https://localhost:8443/api/carts/1/1' \
'Content-Type:application/json;charset=UTF-8' \
'Accept:*/*'
Request Fields
Request HTTP Example
DELETE /api/carts/1/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: */*
Host: localhost:8443
Response
Response HTTP Example
HTTP/1.1 204 No Content
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Frame-Options: SAMEORIGIN
장바구니 다건 삭제
Request
CURL
$ curl 'https://localhost:8443/api/carts/1' -i -X DELETE \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Accept: */*'
HTTPie
$ http DELETE 'https://localhost:8443/api/carts/1' \
'Content-Type:application/json;charset=UTF-8' \
'Accept:*/*'
Request Fields
Request HTTP Example
DELETE /api/carts/1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept: */*
Host: localhost:8443
Response
Response HTTP Example
HTTP/1.1 204 No Content
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Frame-Options: SAMEORIGIN