HTTP
APIs
debugging
browser
developer tools
errors
When a web page uses JavaScript to make requests to an API, things don't always go perfectly. Network errors, incomplete responses, or server issues can occur. Fortunately, modern browsers provide developer tools that allow us to see what's happening behind the scenes, what requests are being sent, what responses are received, and how long they take.
Learning to use these tools is key to understanding, detecting, and solving problems when working with APIs.
In most browsers (like Chrome, Firefox, or Edge), you can open the developer tools by pressing: F12
or right-click ➔ "Inspect" ➔ "Network" tab. The Network tab shows in real-time every request the page makes, the type of request (GET, POST, etc.), the response status (200, 404, 500...), the response size, and the time it took.
Imagine you're a chef, and something goes wrong in the kitchen—a dish is incomplete or poorly served. Without tools, you can only guess what went wrong, but with inspection tools, you can see the entire order, the ingredients, the cooking time, and even if the waiter forgot something. The browser's "Network" tab is like a camera that records every step of the order so you can see what happened in case of issues.
The image shows several tabs to explore:
In the Headers tab, you can see details like the requested URL, the HTTP method used (GET, POST, PUT, DELETE), and the status code to know if the request was successful (200 OK
) or if there was an error (404 Not Found
, 500 Internal Server Error
, etc.). It's important to note that in the browser's Network tab, not all requests come from JavaScript. Some are automatic, like loading images, stylesheets, or scripts. Use the filters ("XHR" or "Fetch") to see only the requests dynamically made by your code, such as fetch()
or XMLHttpRequest
.
💡 Keep in mind that although all modern browsers (Chrome, Firefox, Edge, Safari) offer very similar inspection tools, there may be small differences in the names or layout of the tabs. However, the concepts you learned here apply in all cases.
The browser's Developer Tools Inspector is one of the most powerful allies you'll have as a web developer. Within it, the "Network" tab allows you to see, understand, and fix how data travels between your page and the servers.
Now that you know this tool, we invite you to open any website, explore the inspector, go to the Network tab, and observe what requests are made, what data arrives, and what errors might appear.
Answer these questions to test what you've learned about debugging API requests in the browser:
Which of the following options best describes what you see in the "Network" tab of the Inspector?
What type of requests should you filter if you want to see those made dynamically by JavaScript?
Where can you see the actual content (e.g., a JSON) that the server responded with?
If you see a 404 Not Found
error in a request, what does it mean?
Which of the following statements is correct?