HTTP methods and status codes
We already talked about HTTP methods and status codes in the first chapter, but let’s go through them now in greater detail. Let’s start with the HTTP methods.
HTTP methods
HTTP methods are the verbs that we use to tell the server what we want to do with the resource. The most common methods used in REST APIs are GET, POST, PUT, PATCH, and DELETE. They are commonly used to build CRUD (which stands for create, retrieve, update, and delete) APIs. Here is a brief explanation of each one of those methods.
GET
In REST, the GET method is synonymous with the RETRIEVE verb, allowing you to get data from the server. It should be idempotent, meaning that if you make the same request multiple times, the result should be the same. In REST APIs, we use the GET method in two situations.
The first situation is when you need to get a single resource. Let’s say you send a GET request to a specific resource instance, as in this...