REST APIs in a nutshell
REST stands for Representational State Transfer, and is an architectural style for building APIs. It was introduced by Roy Fielding in his PhD dissertation (https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm) in 2000.
In practical terms, the idea is to define a set of resources that can be accessed by the client using HTTP, as we explored in the previous section.
Each resource is identified by a unique URL, and the client can perform operations on it using the HTTP methods. The server will respond with a status code and a payload when necessary.
For example, let’s say that we have a REST API to manage a database of movies. We can define the following resources:
/movies
: This resource represents the collection of movies/movies/:id
: This resource represents a single movie
Important tip
The :id
part of the URL is a placeholder for the user ID. This is called a URL parameter, and takes the form of /movies...