A REST API (also called a RESTful API) is an application programming interface that respects the constraints of the REST (for “Representational State Transfer”) architecture.
An API, or application programming interface , is a set of definitions and protocols that facilitate the creation and integration of application software. It is sometimes seen as a contract between an information provider and an information user, which defines the content requested from the consumer (the call) and the content requested from the producer (the response). For example, a weather service API might ask the user to provide a zip code and the producer to return a two-part response: the first for the maximum temperature and the second for the minimum temperature.
In other words, when you want to interact with a computer or system to retrieve information or perform a function, an API allows you to tell the system what you want from it, so that it can understand your request and do it. reply.
You can think of an API as a mediator between users, or customers, and the resources they want to access. For a company, it is also a solution to share resources and information, while ensuring security and a certain level of control, determining who is authorized to access and to what.
Another advantage of APIs is that you don't need to know exactly how your resources are being retrieved or where they are coming from.
RESTREST is a set of architectural principles. It is neither a protocol nor a standard. API developers can implement REST in a number of ways.
When a request is made through a RESTful API, the API transfers a representation of the state of the resource to the requestor. This information, or representation, is provided over the HTTP protocol in one of the following formats: JSON (JavaScript Object Notation), HTML, XLT, or plain text. The most commonly used format is JSON because, as the name does not suggest, it is not language dependent and can be read by humans as well as machines.
A RESTful API must meet the following criteria:
A client-server architecture made up of clients, servers and resources, with requests managed via HTTPClient-server communications without condition , that is to say that client information is never stored between requests which must be handled separately, completely independentlyThe ability to cache data to streamline client-server interactionsA uniform interface between the components which allows a standardized transfer of information This implies that:the requested resources are identifiable and separate from the representations sent to the client;the resources can be manipulated by the client by means of the received representation, which contains sufficient information;the self-describing messages returned to the client contain enough detail to describe how the client should handle the information;the API has hypermedia, which allows the client to use hyperlinks to know all the other actions available after accessing a resource.A layered system, invisible to the customer, which enables the different types of servers (for security, load balancing, etc.) involved in retrieving the requested information to be prioritized.On-demand code (optional), i.e. the ability to send executable code from the server to the client (when it requests it) in order to extend the functionality of a client Although the REST API must meet all of these criteria, it is considered to be easier to use than a protocol such as SOAP (Simple Object Access Protocol), which is subject to specific constraints including XML messaging. , integrated security and transaction compliance, which makes it heavier and slower.
Since REST is a set of directives implemented on demand, REST APIs are faster and lighter, ideal for IoT (Internet of Things) and mobile application development.
For more information about: what does an engineer do