Serverspace Black Friday
DF
Daniil Fedorov
May 24, 2024
Updated May 24, 2024

API

An API (Application Programming Interface) is  — an application programming interface, in other words a description of how programs communicate and pass data to each other. API simplifies the formation of program code, as it gives a set of separated classes, functions or structures to work together with the existing information.

This notion applies not just to web development, but also to various software products in principle. Gamepad, fridge, TV, speakers - all without exception have their own API.

What it consists of

The API consists of two parts:

  • The interaction interface;
  • Description.

The interface can be a window which will be supported by text, and the description will answer the question "how does this window work?

Consider the concept of API from a different angle, where the example will be our company:

API *serverspace* is an interface that allows getting information from "serverspace.ru" database via http-requests to a certain server. You do not need to know in detail what database is used and how it is implemented - it is enough that the API request knows about it.

An example of client-server work

Let's assume our company "serverspace" has a client-server API, the API which has certain functions where you can send a request and get an answer.  Suppose the "serverspace.ru" API has the function "return list of services", in this case the browser should make a request to our API company to get the list of services, get the data and render them in the browser page.

It is important to note that API interfaces are limited; you will get only those functions that were laid down by the developer. To add each new function, the programmer must develop it.

Interaction can take place not only between client and server, but also between servers.

Server-server example

Imagine that you decided to buy a train ticket, went to the site, chose a city where you want to go, and the site showed you the weather forecast of this city along with the nearest train dates. No, this does not mean that the ticketing company has its own weather gauges around the world. The ticketing site communicates with some weather service using their API.

 

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.