Introduction to Representational State Transfer (REST)
Representational State Transfer (REST) is an architectural guideline for building a web service. Primarily, it defines a set of constraints that can be followed while designing a web service. One of the key principal REST approaches recommends that the APIs should be designed around resources and should be media- and protocol-agnostic. The underlying implementation of the API is independent of the client consuming the API.
Considering an example of our e-commerce application, say we are searching for a product on the UI using a product's search field. There should be an API that is created for products, and here products are nothing but a resource in the context of an e-commerce application. The URI for that API could be something like the following, which clearly states that we are trying to perform a GET
operation on product entities:
GET http://ecommerce.packt.com/products
The response of the API should be independent...