What is an API? REST principles and CRUD operations

The term API stands for "Application Programming Interface", and refers to what makes it possible to communicate with an application.

Let's explore how these invisible interfaces work, hidden away in the applications we use every day!

Definition of an "API

On a trip to Milan, you'd like to ask the locals for recommendations on the city's landmarks. Problem: you don't speak Italian, and none of the locals around you speak your language. How do you go about it?

It occurs to you to call in a translator. You formulate your question in French, and the translator :

  • Listen to your question in French,
  • Translates it into Italian, 
  • Listen to the answer in Italian, 
  • And translates it back into French.

In short, the translator has passed on your question and in return has provided you with an answer in the language you speak.

In a similar way, an API is a means of communicating with a software program, service or application.

A PLC operates according to the client/server protocol. This protocol corresponds to a specific data transmission mode. Let's take the example of a web surfer using a browser's search engine. 

The Internet user sends a request via a web browser (client). In return, the application (server) must send back a response. If an API is available, it acts as an intermediary between the client and the server, ensuring that the information requested in input is actually transmitted in return.

An API is often associated with documentation, a contract that establishes a set of rules for data transmission between a client and a server. If a request meets certain conditions defined in the contract, the server must provide a corresponding response.

What is a REST API?

A REST API is an API that respects predefined architectural constraints, with the aim of standardizing the web andensuring greater interoperability.

In other words, the term REST API (Representational State Transfer) refers to an API that respects a set of standards and best practices, and uses the HTTP protocol.

CRUD operations and API REST

The majority of requests sent to the API are one of these 4 basic operations: Create, Read, Update and Delete. These operations respectively create, retrieve, modify and delete an entity.

To achieve this, you need to : 

  • Identify all the entities you wish to "connect" to the API
  • Create endpoints on each entity: a create, a read, an update and a delete.

These operations are not found in the code, but are expressed as GET, POST, PUT and DELETE.

The CRUD method allows you to standardize the way you request an API, in line with REST requirements.

Are you interested in this topic?

CONTACT US