The easiest way to see how HTTP APIs are used is directly in the browser. For ease of development and testing, browsers include a developer panel that allows for a complete analysis of the page and the processes taking place within. This also includes information about all HTTP requests.
This article will help you open the developer panel in your browser. In this course, we'll use the Chrome browser bar. The other browsers work almost identically, so it won't be hard to repeat the same thing in other browsers.
Here we're interested in the Network tab. It displays all the requests that the browser performs during page loading. This includes images, fonts, style files, JavaScript and the HTML of the page itself.
Each of the downloadable resources can be clicked on. Several more tabs will appear with information about what HTTP request was sent and what HTTP response was received. Here you can see all the headers and previews of the downloaded resource.
You can also find requests to the HTTP API in the same tab. These requests are executed during the interaction with the page using the API. To separate HTTP API requests from everything else, on the Network tab, press the Fetch/XHR button, then only xhr resources will stay in the list of downloadable resources. These are just requests to the HTTP API.
Let's take the topics on Hexlet as an example. When a user asks or answers a question, the site performs a request to the API. Check it out for yourself:
Study these requests, look at the URL, HTTP headers, HTTP method, response code and the data sent (request body). You can study any site in the same way.
The Hexlet support team or other students will answer you.
A professional subscription will give you full access to all Hexlet courses, projects and lifetime access to the theory of lessons learned. You can cancel your subscription at any time.
Programming courses for beginners and experienced developers. Start training for free
Our graduates work in companies:
From a novice to a developer. Get a job or your money back!
Sign up or sign in
Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.