What is Representational State Transfer (REST)?


What is Representational State Transfer (REST)?

In: 2

I don’t think this is a great ELI5 question as it’s really technical.

But the gist of it is: a rather popular way to write APIs, taking advantage of established HTTP methods like POST/GET/PUT/DELETE, to do CRUD operations.

A REST API is just a set of rules that define how an API communicates. In order for an API to be RESTful, it needs to follow these rules:

* Stateless communication. You can’t say “add a number,” and “add one more to the previous number.” Instead, you have to say “My number is 1,” followed by “My number is now 2.”
* Layered servers, meaning each server has it’s own job that it’s responsible for.
* Caches data
* Standardized format between different parts of the system which you’ll use send information

The actual rules are a bit more detailed, but that’s the basic gist of it. If you want more info, here’s a good webpage, though it’s definitely beyond ELI5, but so is REST APIs: https://www.redhat.com/en/topics/api/what-is-a-rest-api

When interacting with software, it is in a certain state and you use operations to either get information on that current state, or interact with it to achieve a new state.

REST is a standard for writing APIs to interact with software, and describes a way to read and modify the state of a system.