Introducing REST APIs Chapter 4
What is REST?
REST is a web service used for exchanging data between multiple applications via an HTTP
protocol. RESTful Web Services are scalable and easily maintainable.
Here is a simple diagram that explains how the REST Web Service works:
As we can see in the diagram, the client requests some data by making a call to the Rest
Web Service Server. Here, when we send an HTTP Request, we also provide some headers,
such as what type of data we want as a response. These responses could be JSON, XML,
HTML, or any other form. When the server receives the request and pulls data from
storage, it does not simply return the database resources as a response. It sends a
representation of these resources. That's why it is called representational. When the server
responds to the client with this formatted data, the state of our application changes. And
that's why it's called state transfer.
Introducing REST APIs
REST APIs are designed with a RESTful architecture. The APIs built with the principles of
RESTful architecture are called RESTful APIs. RESTful architecture is also called a stateless
architecture because the connection between the client and server is not preserved. The
connection is reset after every transaction between the client and the server.