Chapter 10 of 10All chapters
Chapter 10 of 10
Calling and debugging APIs
Tools and habits.
Try it by hand
curl or an HTTP client sends a request without writing any code, which separates your bug from theirs. The browser network tab shows exactly what was sent and returned.
- Check the status code first, then the headers, then the body.
- A CORS error in the console is a browser rule, not a server failure.
When it is not your fault
Third party APIs go down, rate limit unexpectedly and change without warning. Log the request id they return, handle failure as a normal path, and cache what you can.