curl --request POST \
--url https://api.example.com/api/cart/sync \
--header 'Content-Type: application/json' \
--data '
{
"userId": 123,
"items": [
{
"id": "<string>",
"quantity": 123
}
]
}
'{
"success": true,
"data": {
"id": 123,
"userId": 123,
"items": [
{
"id": 123,
"productoId": 123,
"quantity": 123,
"producto": {}
}
]
},
"error": "<string>"
}Add a new item to the shopping cart
curl --request POST \
--url https://api.example.com/api/cart/sync \
--header 'Content-Type: application/json' \
--data '
{
"userId": 123,
"items": [
{
"id": "<string>",
"quantity": 123
}
]
}
'{
"success": true,
"data": {
"id": 123,
"userId": 123,
"items": [
{
"id": 123,
"productoId": 123,
"quantity": 123,
"producto": {}
}
]
},
"error": "<string>"
}curl -X POST "https://api.pcfix.com/api/cart/sync" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"userId": 123,
"items": [
{
"id": "789",
"quantity": 2
}
]
}'
curl -X POST "https://api.pcfix.com/api/cart/sync" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"userId": 123,
"items": [
{
"id": "789",
"quantity": 2
},
{
"id": "456",
"quantity": 1
}
]
}'
{
"success": true,
"data": {
"id": 1,
"userId": 123,
"abandonedEmailSent": false,
"items": [
{
"id": 45,
"cartId": 1,
"productoId": 789,
"quantity": 2,
"producto": {
"id": 789,
"name": "Gaming Mouse",
"price": 49.99,
"description": "High-performance gaming mouse"
}
},
{
"id": 46,
"cartId": 1,
"productoId": 456,
"quantity": 1,
"producto": {
"id": 456,
"name": "Mechanical Keyboard",
"price": 129.99,
"description": "RGB mechanical keyboard"
}
}
]
}
}
{
"success": false,
"error": "User ID required"
}
| Status Code | Description |
|---|---|
| 200 | Item added successfully |
| 400 | Invalid user ID or request body |
| 401 | Unauthorized access |
| 500 | Server error - Failed to sync cart |
abandonedEmailSent flag is reset to false when items are added