Member-only story
What is a REST API?
And a quick look at the semantics of HTTP verbs

What is a REST API? That question can be broken down into 3 seperate questions:
1/ What is an API , in general?
2/ What is a web API, and how do we use it? What is it for?
3/ What is a REST API? How are RESTfull APIs organized?
Today, we’re going to step into the shoes of a full-stack developper who has to set up a website for a bookstore. And as our imaginary developper wants to do his job well, he’s going to set up an API. What is an API? And why does our developper want to create one?
General concept: what is an API?
An API stands for “Application Programming Interface”. There are two parts to that: Application Programming, on the one hand, and Interface on the other. First of all, what is an “interface”?
Well, it’s quite simple. The name says it all. The word “Interface” is inter / face. It’s something that is in between (inter) two things that are facing each other. For example, the surface of the sea is the interface between water and air.
Often when we talk about an interface, we mean the thing on the screen that explains what the software is doing and allows the user to interact with it. In this case, the interface is the thing that connects the user and the software. That’s why we talk about User Interface or UI, which is the “surface” between the human and the software.
In the case of the API, the two entities that interact are pieces of code. We speak of a software library’s API when referring to the list of public functions it provides. This includes their signature, that is to say: the type of parameters these functions accept and what they return.
But most often, today, when we talk about APIs, we mean communication via the Internet, via the Web. The web communication we are most familiar with occurs when a browser requests a web page, to which the server sends back a lot of HTML and CSS.
Here, in the case of an API, a piece of code (Javascript, for example) sends a request to the server. And the server answers in a format that a computer can understand. Nowadays we often prefer JSON returns since…