Representational State Transfer (REST) is an architecture style for designing network applications. REST is all about resources, so when creating an API, we need to separate it into logical resources. Resources represent information, and they need to be nouns, not verbs.
To manipulate resources, we use HTTP requests where the methods/verbs are meaningful: GET
, POST
, PUT
, PATCH
, and DELETE
.
HTTP methods are used to specify the action that should be performed on a resource. The most popular methods are GET
and POST
, but there are others that are defined as well: CONNECT
, DELETE
, HEAD
, OPTIONS
, PUT
, PATCH
, and TRACE
.
Some HTTP methods do not generate any side effects, so they are called safe methods. GET
, HEAD
, OPTIONS
, and TRACE
are considered safe, while other methods such as POST
, PUT
, PATCH
, and DELETE
are unsafe because they are normally used to change the state of a resource on the server.
Another property of methods is idempotence. A method is idempotent...