Site icon Trends Tech Blog

How To Work The REST API

How To Work The REST API

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.

REST 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.

REST Constraints

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:

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:

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

Exit mobile version