What is an API?

An API (Application Programming Interface) is a set of rules, protocols and tools that enables computer applications or systems to communicate with one another. It defines how software components should interact, by exposing functionality or data in a standardised format.

Key principles

Standardised interface
An API is like a contract: it describes the available methods, expected parameters and response formats. This allows developers to use services without having detailed knowledge of their internal workings.
Abstraction and security
An API masks the system's internal complexity, and restricts direct access to sensitive data. It exposes only what is strictly necessary. This is often achieved by using some form of authentication (e.g. API keys, or OAuth).
Interoperability
Thanks to APIs, heterogeneous systems can exchange information. For example, a mobile app can query a server via a REST API to obtain JSON-formatted data.

Types of API

  • REST APIs: based on the HTTP protocol, using methods such as GET, POST, PUT and DELETE. Typical file format: JSON;
  • SOAP APIs: older, based on XML, implementing strict standards;
  • GraphQL APIs: can be used to query precisely the data that is needed;
  • Local APIs: for communication between the different components of the same system;
  • Public vs. private APIs: open to all or reserved for internal use.

Advantages

  • Reusability: an API can be used by several different applications;
  • Scalability: systems can evolve without interfering with existing integrations;
  • Automation: enable the integration of third-party services (e.g. payment services, weather forecasting, maps).

Last update