A customer writes in: where's my package?
To answer, you start with their account. The account leads to their orders. One of those orders has an ID, and only with that ID can you ask the shipping service where the package is.
Three questions, asked in order, each one waiting on the answer before it. That's an API chain. None of it can run side by side, and if one answer comes back empty, the next question has nothing to go on.
What a chain actually needs
In API terms, that's three services: users, orders and shipping, each called with something the last one returned.
The hard part isn't making the calls. It's moving data between them. Somebody has to pick the right field out of one response, hand it to the next request, and decide what happens if the field isn't there. In most codebases that's hand-written glue, repeated for every new chain.
Passing data from step to step
In Unmeshed, each call is a step in a workflow, and a later step can reference the output of an earlier one using double curly brackets. So the order step can read a value from the user step's response, and the shipping step can read the order ID from the order step. You build the three calls as HTTP GET tasks, wire the references, and the platform runs them in order.
You never write the code that passes the values along. You also get a visual trace of the run, so you can open each step and see exactly what went in and what came back.
Three ways chains go wrong
- A field is missing or shaped differently. The next call depends on it, so it fails or runs with an empty value. This is why every service in the chain should return JSON with consistent, predictable fields.
- A step fails halfway. The earlier calls already happened. You need to know where it stopped, and you want to rerun from there, not from the beginning.
- Environment details are baked in. Hard-coded URLs make a flow that works in testing and breaks in production. Keep the configuration separate from the logic so the same flow runs in more than one environment.
Keeping it reviewable
A flow that lives only in a visual editor is hard to review and hard to roll back. Unmeshed lets you export process definitions as JSON, so a chain can be versioned, reviewed and deployed with the rest of your code.
Chained calls are one of the most common integration patterns, and they're also the one most likely to turn into a pile of glue code nobody wants to touch. If you have a chain like this, try building it in Unmeshed and compare it with what you maintain today.
Top comments (0)