[SHARING] - What is REST?

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.

In REST architecture, APIs expose their functionality as resources. The resources may be any type of service, data, or simply an object that a client can access. Each resource has its own unique URI (Uniform Resource Identifier) that a client can access by sending a request to the server. The state of a resource at any particular instant, or timestamp, is known as the resource representation. This information can be delivered to a client in virtually any format including JavaScript Object Notation (JSON), HTML, XLT, Python, PHP, or plain text. JSON is popular because it’s readable by both humans and machines—and it is programming language-agnostic.

Features of REST

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

3 Likes

Well, a new concept of testing to me. Thank you

1 Like