Scenario
Chained Order Pipeline
Pure REST, no cookies: create an order, capture its id, confirm payment, then ship — each transition is validated against the current state (409 if you skip a step), and continuity comes entirely from the id in the URL.
How this works
- · A pure REST resource with no cookies at all — POST /orders returns an id, and every later call (confirm-payment, ship) takes that id in the URL. Continuity comes entirely from the id you captured, not from a session.
- · Each transition is validated against the order's current state — trying to ship before payment is confirmed returns 409 Conflict, not a silent no-op or a generic error.
- · State is one shared in-memory array, visible to anyone hitting the API — reset it with POST /pipeline/reset.
What you'll practice
- Capturing an id from one response and using it as a path parameter in the next request — the core "chaining" skill
- Valid state transitions only: pending → paid → shipped, in that order — skipping a step returns 409, not a silent no-op
- No cookies involved at all — continuity comes purely from the order id, exactly like a real REST API
- Every order is visible to every visitor (shared in-memory) — see the Test Data page
API reference
POST /api/scenarios/pipeline/orders
→ { order: { id, status: "pending" } } (201)
GET /api/scenarios/pipeline/orders/:id
→ current order state, or 404
POST /api/scenarios/pipeline/orders/:id/confirm-payment
pending → paid, or 409 if not currently pending
POST /api/scenarios/pipeline/orders/:id/ship
paid → shipped (adds a trackingNumber), or 409 if not currently paid
curl -X POST https://playground.krishanchawla.com/api/scenarios/pipeline/orders
curl -X POST https://playground.krishanchawla.com/api/scenarios/pipeline/orders/<id>/confirm-payment
curl -X POST https://playground.krishanchawla.com/api/scenarios/pipeline/orders/<id>/ship
- 1 Console