What it is

REST is a set of guidelines for architecting an API with Uniform Resource Identifiers (URI). It isn’t restricted to use on HTTP APIs, but it is nearly always spoken of in this context. A REST API is the typical web interface used to send data back and forth between the frontend and backend of a web app.

A web app hooks up to a backend using an HTTP-based API. HTTP has a several different “verbs": GET, PUT, POST and DELETE. Typically, a web API needs to do a few actions: Create, Read Update and Delete (CRUD) elements like users or tweets or whatever.

REST, standing for Representational State Transfer, gives recommendations for how to map these CRUD actions onto URL routes and HTTP verbs. For example, DELETEs should be idempotent, meaning that if you run the same request multiple times it won’t have any side effects. Designing your api to delete a tweet to be:

DELETE /api/tweets/my-tweet-id

instead of

DELETE /api/tweets/most-recent

or whatever other alternative is wise because requests can easily be lost or duplicated due to network errors. In the second design example, you may accidentally delete multiple tweets if the request was spuriously sent twice.

REST APIs are not the only way to communicate between the frontend and backend of a web app. Some other alternatives include web sockets or GraphQL.

Why it matters

Following the conventions of REST when designing your APIs make them safe, predictable, and easy to understand by other devs who are aware of the common convention. it is so common that it’s a safe bet that other websites APIs, like twitter’s, will be “RESTful”.

How to learn it

You can learn everything you need to know about REST APIs from