How to test an API flow end to end: a table booking
Booking a table takes four requests: free time slots, the booking, its status, the cancellation. Testing them one by one means copying an id from each response into the next URL and remembering the order. A bug at step three surfaces when someone notices bookings that never got confirmed. In Microkoi Bench these requests become a chain you run with one click.
Why a flow breaks between requests
Each endpoint returns 200 on its own. What breaks is the link between them: the booking is made for a time someone already took, the status comes back pending while the screen waits for confirmed, the cancellation doesn’t free the table. Testing one request at a time doesn’t show any of this.
Take a restaurant table booking app. The guest’s path is four requests, and all of them are already in the collection:
| Step | Request | Passes on |
|---|---|---|
| “Free slots” | GET /restaurants/ | slotId |
| “Booking” | POST /bookings | bookingId |
| “Booking status” | GET /bookings/ | — |
| “Cancel booking” | DELETE /bookings/ | — |
The last step isn’t decoration: a check that makes bookings has to clean up after itself, or the test restaurant is fully booked by evening.
Create the chain
- In “Requests”, click the arrow next to the “Request” button above the collection tree and choose “New chain”. To put the chain in a specific folder, hover over the folder and choose “⋯” → “New chain in folder”.
- Type a name, for example “Table booking”, and press Enter. The chain tab opens with “No steps yet”.
- Click “Add step”, start typing the request’s name or URL, pick it with the arrow keys, and press Enter.
- Drag the other requests from the tree straight onto the strip: a line shows where the step will land.
A step references the collection request instead of copying it. Edit the request, and the change applies to every chain it’s in.
The strip shows what gets passed on
Steps run top to bottom as a strip. Each step block shows the method, name, URL with variables highlighted, and expectations. The arrow between steps shows the variables a step passes on: slotId after the first, bookingId after the second.
Values are taken by the rules in each request’s “After response” tab. The fastest way to add a rule is from the response itself: “Model” → “Save to variable” on the field you need. More on this in “Variables from an API response: pass the order id to the next request”.
If a step needs a variable that nothing before it sets, the block gets a yellow label with its name and “isn’t set by earlier steps or “Stage””. That tells you the steps are in the wrong order or a request is missing a rule.
Reorder a step and bring it back
Drag a block by the handle on its left and drop it where the line appears. From the keyboard, use ⌥↑ and ⌥↓ on the selected step, or Alt+↑ and Alt+↓ on Windows and Linux. The variable labels on the arrows update right away.
Move “Booking” above “Free slots”, and it immediately gets a yellow slotId label: nothing has produced the value yet. ⌥↓ puts the step back.
To drop a step, choose “Remove from chain” in the block’s “⋯” menu. There’s no dialog: a bar above the strip says “Step removed. “Cancel booking” is still in the collection.” The “Undo” button or ⌘Z (Ctrl+Z) puts the step back where it was.
What to expect from each step
With no conditions, a step passes on any status code from 200 to 299. That’s not enough for a flow: a booking can return 200 and still stay unconfirmed. Select a step to open its properties on the right, and under “Expect” click “Add condition”.
| Step | Expectation |
|---|---|
| “Free slots” | “JSON value” data.slots[0].id “exists” |
| “Booking” | “Status code” 201 |
| “Booking status” | “JSON value” data.status “equals” confirmed |
| “Cancel booking” | “Status code” 204 |
If a condition fails, the chain stops at that step. A restaurant may not confirm a booking right away. In that case, give “Booking status” a pause or a repeat under “Before the step”: the step waits for confirmed instead of failing on the first pending.
Run it with one click
Pick an environment on the tab bar and click “Run” or press ⌘↩. You don’t have to save first: Bench runs what’s on screen. A bar above the strip shows “Running step 2 of 4…”, and each step gets its status code and time.
If the server answers the booking with 409, the bar turns red: “Chain stopped at step 2 of 4 — Booking.” Below it are the cause, method, and URL. The panel under the strip shows the step’s response, the request with values filled in, and the run variables. The backend gets a specific response for a specific time slot, not “bookings sometimes fail”.
The chain lives next to the code
⌘S saves the chain as a .chain.json file in the collection folder, next to its requests. Put the workspace in git, and testers and developers run the same flow, while checking a backend fix takes one click.
Build a chain for your app’s main flow and write to beta@microkoi.com about the steps or expectations you were missing. We read every email.