The World Wide Web is a network of heterogeneous machines, which work with heterogeneous systems, which execute applications written in equally heterogeneous languages. The whole must be able to communicate and offer services such as those we know (search engines, multimedia platforms). But what is the place of the REST API?
The Rules Of Communication
An API, Application Program Interface, is, as its name suggests, a system of rules between applications, which allows them to communicate with each other. In the client-server framework, when you, the client, call up service, on a server, you send your request in such a way that the service provider understands the proposal. The answer, too, must be shaped so that you can understand it.
For example, during a search on the web, you make a dedicated search engine query. According to the criteria of the latter (title, type of resource (text, image)), the engine returns a response. Your browser interprets this to display the result in the expected form. This is the role of an API.
The REST API, Representational State Transfer, sometimes referred to as RESTful, is an API that enables the communication between two web applications in a lightweight and efficient manner.
It was defined by Roy Fielding, a significant contributor to the HTTP protocol, in his doctoral thesis on styles of software architecture. The REST API is based on the HTTP protocol. It makes particular use of the GET, POST and PUT methods. The exchange format between the client and the server is not defined, it can just as quickly be JSON, XML, as plain text. It’s a perfect API for a headless content management system like Strapi.
The REST API does not describe any implementation, just a set of rules. An application is considered RESTful if it respects six constraints established by Roy Fielding:
- Communication takes place between two applications with different roles: a client and a server.
- The requests sent by the client are independent of each other. Each of them contains all the information necessary for the processing of the claim by the server.
- Responses must explicitly allow or not their caching. This avoids the use of obsolete data, and makes it possible to optimize communication in the case of “cacheable” data.
- The communication interface must be uniform, i.e. respect a certain number of rules:
- Identifiable resources (URI).
- Resources that can be handled by the server.
- Self-describing messages, the content is sufficient for the server to respond to the request.
- Hypermedia as the Engine of Application State.
- Submissions must be able to be encapsulated. A server can thus call on another server to respond to a claim in a completely transparent way.
- The server must be able to send executable code, such as Java Scripts or JAVA applets, to the client to add temporary functionality to it.
Few implementations respect the six rules. To define a level of compliance, it is possible to refer to the Richardson maturity model. Composed of 4 levels, from 0 to 3, based on four criteria:
- Resource Identification (URI).
- HTTP implementation level (GET, POST, etc.).
- HTTP return codes.
A Robust, Light And Efficient Interface
The REST API is a set of rules that allows interoperability between a client and a server. It is based on the robust HTTP protocol, exchanging data, in most cases, in JSON format, which is both efficient and easily readable by humans. An apparent interest is the client-server decoupling.
Also Read: The Implied Meaning Of Watches
- Movierulz4 and 4movierulz New Link 2022 – Tamil + Telugu + Hindi + Kannada movies Download - December 6, 2022
- How to Get Deleted Photo Back With or Without Software- Solved! - November 30, 2022
- Wondershare Filmora Review: The Most Elegant Video Editor - November 30, 2022