Free Shopping Cart API — REST Endpoint for Testing & Development
Manage shopping cart operations with session handling, item management, and checkout preparation. This endpoint provides realistic mock data and behaviors, making it perfect for frontend testing, QA, software demos, and programming tutorials.
/api/cart/{sessionId}
Get cart contents for session. Creates a new cart if sessionId is new or cart expired. Replace {sessionId} with an ID (e.g., sess_123).
Replace placeholders (e.g., {userId}) with actual values in the path above. You can also add/edit query parameters (e.g., ?key=value).
/api/cart/{sessionId}/items
Add an item to the cart. Replace {sessionId} with a session ID.
Replace placeholders (e.g., {userId}) with actual values in the path above.
/api/cart/{sessionId}/items
List all items in the specified cart. Replace {sessionId} with a session ID.
Replace placeholders (e.g., {userId}) with actual values in the path above. You can also add/edit query parameters (e.g., ?key=value).
/api/cart/{sessionId}/items
Update quantity of an item in the cart. Expects itemId and new quantity. Replace {sessionId} with a session ID.
Replace placeholders (e.g., {userId}) with actual values in the path above.
/api/cart/{sessionId}/items
Remove an item from the cart. Expects itemId. Replace {sessionId} with a session ID.
Replace placeholders (e.g., {userId}) with actual values in the path above.
/api/cart/{sessionId}
Update cart metadata, e.g., apply a coupon code. Replace {sessionId} with a session ID.
Replace placeholders (e.g., {userId}) with actual values in the path above.
/api/cart/{sessionId}
Clear all items from the cart (cart session persists but is empty). Replace {sessionId} with a session ID.
Replace placeholders (e.g., {userId}) with actual values in the path above.
cURL Request
curl -X GET https://gen-endpoint.com/api/cart/{sessionId}Sample JSON Response
{
"id": "sess_123",
"userId": null,
"items": [
{
"id": "item_abc",
"productId": "prod_123",
"name": "Wireless Headphones",
"priceAtTimeOfAddition": 99.99,
"quantity": 1,
"imageUrl": "https://placehold.co/100x100.png",
"options": {
"color": "black"
},
"subtotal": 99.99
}
],
"subtotal": 99.99,
"tax": 8,
"shipping": 0,
"discount": 0,
"total": 107.99,
"createdAt": "2024-08-20T10:00:00Z",
"updatedAt": "2024-08-20T10:05:00Z",
"expiresAt": "2024-08-21T10:00:00Z"
}Is this API free?
Yes! This API is completely free to use for personal, learning, and development purposes. There are no strict usage limits for standard personal use.
Does it require authentication?
Most of our endpoints are public and do not require any API keys or authentication. You can start sending requests immediately.
What does the response look like?
Our APIs return standardized JSON responses mimicking real-world data structures, ensuring easy parsing and integration for your frontend or tools.
Can I use this in production?
No. These endpoints are designed solely for testing, development, and demonstration purposes. They provide mock data and do not guarantee uptime or data persistence required for production applications.