A product grid, a detail page and a checkout need an API that returns products and accepts orders. The shop template gives you those endpoints behind a real URL, so you can build the storefront before the real catalog and order service exist.
What you get
The template creates a project with the base path /shop and 4 endpoints. Each endpoint has one ready response, so the API answers as soon as the project exists.
| Method | Path | What it answers |
|---|---|---|
GET |
/products |
200 with three products in items and total. |
GET |
/products/:id |
200 with one product. The id is the one from the path. |
POST |
/orders |
201 with an order in status created. |
GET |
/orders/:id |
200 with one order. The id is the one from the path. |
Product names and prices are fixed: three household items with priceCents in euro cents and the currency EUR. The product detail adds description, stock and color. An order has id, status, items (with productId, quantity and unitPriceCents), totalCents, currency and createdAt. The data is invented; there are no real products or brands in it.
Sample response
$ curl -s $URL/shop/products
{
"items": [
{"id": "101", "name": "Ceramic coffee mug",
"priceCents": 1290, "currency": "EUR",
"inStock": true, "rating": 4},
{"id": "102", "name": "Linen tea towel",
"priceCents": 890, "currency": "EUR",
"inStock": false, "rating": 5},
{"id": "103", "name": "Oak cutting board",
"priceCents": 3450, "currency": "EUR",
"inStock": true, "rating": 3}
],
"total": 3
}
Ids, names and prices stay the same. inStock and rating (3 to 5) are generated on every call, so your output differs. Line breaks are added here for reading.
How to start
- Sign up at
https://app.mockhop.com/register. The quickstart explains the account and the address of your organization. - Open Projects and select Start from a template.
- Choose Example shop and select Use template.
Then call the mock. Replace acme with your organization's address. Your mocks answer from outside once you've confirmed your email address.
$ URL=https://acme.mockhop.cloud
$ curl -s $URL/shop/products/101
$ curl -s -X POST $URL/shop/orders
The first call returns the product detail with a generated stock and color. The second answers 201 with an order in status created: one line for product 101, a generated quantity between 1 and 4 and the matching totalCents.
What to do next
- Change the responses. Open an endpoint and edit the status code, headers and body of its response, or add more responses with matching rules.
- Add error cases and delays. For example a
409onPOST /orderswhen an item is out of stock, a404for an unknown product, or a slow product list. See Simulate API errors, timeouts and rate limits. - Use scenarios for flows. For example an order that is
createdon the first call, thenpaid, thenshipped. Mock polling and multi-step flows shows the pattern. See Scenarios; scenarios are included from the Pro plan. - Export the project. Under Import/Export you can download the project as an OpenAPI 3.0 file.
Good to know
- Responses are generated per request and the mock keeps no state.
POST /ordersdoes not read your request body: the order always contains product101, and the order you get fromGET /orders/:idis not the one you created. GET /orders/:idreturns the id from the path with a generated status (created,paid,shippedordelivered), so the status can change between two calls.GET /products/:idreturns the same coffee mug for every id.- No stock is reserved and nothing is charged.
- The template creates a new project, and no other project in your organization may use the base path
/shop. The Free plan includes one project. - You can change or delete the project and each of its endpoints at any time.
New to Mockhop? Start with the quickstart. Plans: pricing.