ShoppingCart Rest
Requests:
curl --location --request POST 'http://localhost:5000/shoppingCart/addShoppingPost' \
--header 'Content-Type: application/json' \
--data-raw '{
"customerEmail": "another2@example.com",
"shoppingPostId": 1,
"shoppingPostQuantity": 2
}'
curl --location --request POST 'http://localhost:5000/shoppingCart/removeShoppingPost' \
--header 'Content-Type: application/json' \
--data-raw '{
"customerEmail": "another2@example.com",
"shoppingPostId": 1,
"shoppingPostQuantity": 1
}'
curl --location --request GET 'http://localhost:5000/shoppingCart/list' \
--data-raw ''
curl --location --request GET 'http://localhost:5000/shoppingCart/findById/1'
curl --location --request GET 'http://localhost:5000/shoppingCart/findByCustomer/another2@example.com'
curl --location --request DELETE 'http://localhost:5000/shoppingCart/delete/1'
Ese último es para usar solo desde el back.
Response de findById:
{
"id": "2",
"subtotal": 2000.0,
"total": null,
"customerEmail": "another2@example.com",
"shoppingPosts": {
"1": 2
}
}
Donde en: "shoppingPosts": { "1" (shoppingPostId): 2 (quantity) }