A REST API (also known as RESTful API) is an application programming interface (API or web API) that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services. REST stands for representational state transfer and was created by computer scientist Roy Fielding.
Before moving forward, it is crucial to understand that REST is a set of architectural constraints and is not a protocol or standard.
REST-compliant web services allow the requesting systems to access and manipulate textual representations of web resources by using a uniform and predefined set of stateless operations. When HTTP is used, the most common operations available are GET, POST, PUT, and DELETE. A REST API would use a GET request to retrieve a record, a POST request to create one, a PUT request to update a record and a DELETE request to delete one. A well-designed REST API is similar to a website running in a web browser with built-in functionality.
Stateless: REST APIs are stateless. As per the REST architecture, the server does not store any state about the client session on the server-side. Each and every request from the client to the server must contain all the necessary information to understand the request.
Cacheable: The applications are often cacheable. It is achieved by marking the response from the server as cacheable or non-cacheable either implicitly or explicitly.
Layered System: An application is made more stable by giving it a layered system architecture and limiting its component behavior. The layered architecture enhances the application security as components in each layer cannot interact beyond their next immediate layer.
Uniform Interface: REST’s interface constraints, resource identification, self-descriptive messages, resource manipulation using representation, and hypermedia as the engine of application state helps to obtain uniformity throughout the application.
Error messages: REST APIs offer the advantage of including error messages if the developer makes any mistake while working with an API