Exposing our REST API
Let’s understand a few concepts that we are going to use in this section:
- REST – REST stands for Representational State Transfer. It is a widely accepted set of guidelines for creating web services. REST is independent of the protocol used, but most of the time, it is tied to the HTTP protocol that normal web browsers use. Some of the design principles behind REST include the following:
- A resource has an identifier – for example, the URI for a particular order might be
https://what-ever-shop.com/orders/1
. - Uses JSON as the exchange format – for example, a
GET
request tohttps://what-ever-shop.com/orders/1
might return the following response body:{"orderId":1,"orderValue":0.99,"productId":100,"quantity":10}
- REST APIs built on HTTP are called using standard HTTP verbs to perform operations on resources. The most common operations are
GET
,POST
,PUT
,PATCH
, andDELETE
.
- A resource has an identifier – for example, the URI for a particular order might be
- API – API is...