Add Product to Cart
Add item product to user cart
Endpoint
Base URL
http://localhost:8080
Method and Endpoint
POST /api/users/current/cart
Headers
Authorization: Bearer access_token
Query Param
product_id
: string (required)
Request Body
Request Body
{
"quantity": "2"
}
Responses
You will get responses like this:
200 (success)
Response Body
{
"message": "Successfully added product to the cart"
}
400 (bad request)
Response Body
{
"error": "product stock is less than quantity"
}
500 (server error)
Response Body
{
"error": "Internal server error"
}
500 (server error - failed)
If query to database
get troble while get the user cart
data
Response Body
{
"error": "failed check user cart"
}
500 (server error - failed)
If something went wrong while adding product
to the cart
Response Body
{
"error": "failed add this product to the cart"
}