A small e-commerce flow: browse products, build a cart, apply coupons and check out. Out-of-stock items return 409, invalid coupons 422, expired coupons 410, and checkout honors Idempotency-Key so retries never double-charge.
The Shop API is a checkout: products with real stock counts, carts, and coupons that expire. Stock is decremented on checkout, so the interesting failures happen between adding an item and paying for it — which is precisely the window most e-commerce test suites skip.
Base URL: https://funapi.dev/api/shop/v1 · 9 endpoints · OpenAPI 3.1 spec and Postman collection available. New here? Read the getting started guide.
GET https://funapi.dev/api/shop/v1/products — List products, filter by category. No token, no signup:
curl -i https://funapi.dev/api/shop/v1/products
answers 200 OK with:
{
"total": 6,
"data": [
{
"id": 1,
"name": "Rubber Duck (QA Edition)",
"price": 9.99,
"stock": 12,
"category": "office"
},
{
"id": 2,
"name": "Mechanical Keyboard, Extra Clicky",
"price": 129,
"stock": 5,
"category": "office"
},
{
"id": 3,
"name": "Limited Sneaker Drop",
"price": 249.99,
"stock": 0,
"category": "fashion"
},
{
"id": 4,
"name": "Coffee Beans, 1kg, Depressingly Strong",
"price": 18.5,
"stock": 40,
"category": "food"
},
{
"id": 5,
"name": "HTTP Status Cats Poster",
"price": 14,
"stock": 7,
"category": "decor"
},
{
"id": 6,
"name": "Infinite TODO Notebook",
"price": 11.25,
"stock": 3,
"category": "office"
}
]
}
things you do not need
GET /shop/v1/products — List products, filter by category · Responds with 200 Link to this endpointGET /shop/v1/products/{id} — Get one product · Responds with 200 404 Link to this endpointadd, remove, regret
POST /shop/v1/carts — Create an empty cart · Responds with 201 400 Link to this endpointGET /shop/v1/carts/{id} — Get a cart with its running total · Responds with 200 404 Link to this endpointPOST /shop/v1/carts/{id}/items — Add a product (409 when out of stock) · Responds with 200 400 404 409 Link to this endpointDELETE /shop/v1/carts/{id}/items/{productId} — Remove a product from the cart · Responds with 200 404 Link to this endpointwhere the money pretends to move
GET /shop/v1/coupons/{code} — Validate a coupon (410 when expired) · Responds with 200 404 410 Link to this endpointPOST /shop/v1/carts/{id}/checkout — Check out (idempotent, coupon-aware) · Responds with 201 400 404 409 422 Link to this endpointGET /shop/v1/orders/{id} — Get an order · Responds with 200 404 Link to this endpointLast updated