Register to get access to free programming courses with interactive exercises

About the course HTTP API

API usually means the way in which programs or services can request data from other services. Let's look at an example.

Twitter has a website where we can view tweets. By clicking on links, we can go to different addresses where different information is available: the tweets feed, the page of a specific tweet, your personal account, password reset, ad account, and so on.

Each of these pages returns some HTML in which the information is presented as we see it, with all the design elements. Twitter is adapted for small screens, so it opens from any device with a browser. But in addition to the website Twitter has a mobile application, which shows the same information, but with a different, more convenient interface, adapted to a particular phone.

The mobile app, unlike the website, is stored physically on the phone and runs directly on it. And the entire appearance is also defined within the application. For such an application to work, you also need pure data, which are not on your phone, but on Twitter's servers. How do I download them to my phone? Ordinary page addresses don't work for us, because they don't return data, but rather ready-made html pages.

This is where APIs come to the rescue. Twitter provides specific HTTP addresses that make pure data available, not specific internet pages with a ready-made look and feel. Data at such addresses are given in a structured format, most often JSON. One service packs the data into JSON format, the other, which follows the data, unpacks it from JSON and uses it internally for display purposes. An example of a user request:

# The address to which the list of specified users is returned
# In this case, one user is requested
https://api.twitter.com/2/users/by?usernames=hexletHQ

# This is the JSON structure you get in response:
{
  "data": [
    {
      "created_at": "2013-12-14T04:35:55.000Z",
      "id": "2244994945",
      "name": "HexletHQ",
      "description": "Hexlet - programming courses",
      "pinned_tweet_id": "1464165859761573893",
      "username": "hexlethq"
    },
  ],
}

The purpose of this API is to provide convenient access to Twitter data. And this API is used both by Twitter itself in mobile applications and by third-party services that manage Twitter. For example, marketers use services that automatically publish tweets on a schedule.

The Twitter API is an example of an HTTP API; it works over the HTTP protocol, through which browsers load and display sites. HTTP is the most common and convenient way to make APIs for public Internet services. The whole Internet is geared towards it, it has good support in any programming language. After all, it's a simple protocol that everyone involved in web or mobile app development knows one way or another.

In this course, we'll talk about what HTTP APIs are and how they work. We'll learn how to make queries to APIs to analyze and test it using curl and the Postman service. Let's get acquainted with the OpenAPI standard (formerly Swagger), which is used to describe the API format.

Preparation

The course focuses on how to build an API using HTTP, which is studied in another course. We recommend going through it if you're not familiar with HTTP. Also, courses on command line basics and HTML.


Hexlet Experts

Are there any more questions? Ask them in the Discussion section.

The Hexlet support team or other students will answer you.

About Hexlet learning process

For full access to the course you need a professional subscription.

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.

Get access
130
courses
1000
exercises
2000+
hours of theory
3200
tests

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.bookmate">Bookmate</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.healthsamurai">Healthsamurai</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.dualboot">Dualboot</span>
<span class="translation_missing" title="translation missing: en.web.courses.lessons.registration.abbyy">Abbyy</span>
Suggested learning programs
profession
Development of front-end components for web applications
10 months
from scratch
Start at any time

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions
Toto Image

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.