Letting the AI do the calling — while you check the shape
Here's the practical division of labor. The AI is genuinely good at writing API-calling code: it knows the libraries, the header syntax, the error handling. Let it. You don't write this plumbing by hand.
But you own one thing the AI is bad at: knowing whether the data shape is actually right. A good workflow:
- Give the AI the real docs. Paste the example request and response from the docs into your . The AI guessing an 's shape from memory is a top source of bugs — it will invent plausible-looking keys that don't exist. Real examples anchor it to reality.
- Ask it to show you the raw response first. "Before parsing, log the actual the API returns." Then eyeball it against what the code expects. Does the key it reads (
response.current.temp) actually exist in the response? Half of API bugs are a mismatched key name. - Sanity-check the types. Is that a number or a string? Is a field that should always be present sometimes
null? You can read JSON now — use it. - Handle the unhappy path. Ask: "What happens if this call fails, times out, or hits the ?" If the answer is "the app crashes," that's a bug, not a feature.
You don't need to write the request. You need to read the response and ask "is this the shape I expected?" That single habit — checking the data against the contract — catches the majority of integration bugs before your users ever see them.