Cart

Content negotiation

Cart Endpoints

client

Method URI Name Summary
POST /v1/cart/{customerId} add item to cart Add Item to Cart
DELETE /v1/cart/{customerId} clear cart Clear Cart
GET /v1/cart/{customerId} get cart Get Cart
DELETE /v1/cart/{customerId}/{sku} remove cart item Remove Item
PUT /v1/cart/{customerId}/{sku} update cart item quantity Update Item Quantity

Paths

Add Item to Cart (addItemToCart)

POST /v1/cart/{customerId}

adds an item to an existing cart

Parameters

Name Source Type Go type Separator Required Default Description
customerId path string string a customer’s id
body body AddItemToCartRequest models.AddItemToCartRequest

All responses

Code Status Description Has headers Schema
200 OK A successful response. schema

Responses

200 - A successful response.

Status: OK

Schema

AddItemToCartResponse

Clear Cart (clearCart)

DELETE /v1/cart/{customerId}

clear a customer’s cart

Parameters

Name Source Type Go type Separator Required Default Description
customerId path string string a customer’s id
body body ClearCartRequest models.ClearCartRequest

All responses

Code Status Description Has headers Schema
200 OK A successful response. schema

Responses

200 - A successful response.

Status: OK

Schema

ClearCartResponse

Get Cart (getCart)

GET /v1/cart/{customerId}

returns a shopping cart if one exists

Parameters

Name Source Type Go type Separator Required Default Description
customerId path string string a customer’s id

All responses

Code Status Description Has headers Schema
200 OK A successful response. schema

Responses

200 - A successful response.

Status: OK

Schema

GetCartResponse

Remove Item (removeCartItem)

DELETE /v1/cart/{customerId}/{sku}

removes an item from a customer’s cart

Parameters

Name Source Type Go type Separator Required Default Description
customerId path string string a customer’s id
sku path string string an Item’s sku
body body RemoveCartItemRequest models.RemoveCartItemRequest

All responses

Code Status Description Has headers Schema
200 OK A successful response. schema

Responses

200 - A successful response.

Status: OK

Schema

RemoveCartItemResponse

Update Item Quantity (updateCartItemQuantity)

PUT /v1/cart/{customerId}/{sku}

updates a cart item’s quantity

Parameters

Name Source Type Go type Separator Required Default Description
customerId path string string a customer’s id
sku path string string an item’s sku
body body UpdateCartItemQuantityRequest models.UpdateCartItemQuantityRequest

All responses

Code Status Description Has headers Schema
200 OK A successful response. schema

Responses

200 - A successful response.

Status: OK

Schema

UpdateCartItemQuantityResponse

Models

AddItemToCartRequest

Properties

Name Type Go type Required Default Description Example
customerId int64 (formatted integer) int64 a customer’s id
item Item Item an Item object

AddItemToCartResponse

Properties

Name Type Go type Required Default Description Example
cart Cart Cart a Cart object
status ResponseStatus ResponseStatus a ResponseStatus object

Cart

Properties

Name Type Go type Required Default Description Example
items []Item []*Item a collection of Item
totalPrice double (formatted number) float64 the sum total of the cart

ClearCartRequest

Properties

Name Type Go type Required Default Description Example
customerId int64 (formatted integer) int64 a customer’s id
status ResponseStatus ResponseStatus a ResponseStatus object

ClearCartResponse

Properties

Name Type Go type Required Default Description Example
status ResponseStatus ResponseStatus a ResponseStatus object

GetCartRequest

Properties

Name Type Go type Required Default Description Example
customerId int64 (formatted integer) int64 a customer’s id

GetCartResponse

Properties

Name Type Go type Required Default Description Example
cart Cart Cart a Cart object
status ResponseStatus ResponseStatus a ResponseStatus object

Item

Properties

Name Type Go type Required Default Description Example
expiresAt string string when this item expires in the cart
price double (formatted number) float64 the item’s price
quantity int32 (formatted integer) int32 how many of identical items
sku string string an item’s variant sku number

JwtToken

Properties

Name Type Go type Required Default Description Example
accessExpire int64 (formatted integer) int64
accessToken string string
refreshAfter int64 (formatted integer) int64

RemoveCartItemRequest

Properties

Name Type Go type Required Default Description Example
customerId int64 (formatted integer) int64 a customer’s id
quanity int32 (formatted integer) int32 a new quantity
sku string string an item’s variant sku number

RemoveCartItemResponse

Properties

Name Type Go type Required Default Description Example
cart Cart Cart a Cart object
status ResponseStatus ResponseStatus a ResponseStatus object

ResponseStatus

Properties

Name Type Go type Required Default Description Example
statusCode int64 (formatted integer) int64 RFC http status code, ie. 204, etc - https:go.dev/src/net/http/status.go
statusMessage string string status message

UpdateCartItemQuantityRequest

Properties

Name Type Go type Required Default Description Example
customerId int64 (formatted integer) int64 a customer’s id
quanity int32 (formatted integer) int32 a new quantity
sku string string an item’s variant sku number

UpdateCartItemQuantityResponse

Properties

Name Type Go type Required Default Description Example
cart Cart Cart a Cart object
status ResponseStatus ResponseStatus a ResponseStatus object

Feedback

Was this page helpful?


Last modified January 19, 2022: content update (ec6fd04)