What Is a RESTful Service? | ASP.NET Web API Interview Question | RESTful Service Programmer Guide

,
Representational State Transfer (REST) is an architectural style. The term REST was introduced and defined by Roy T. Fielding in his doctoral dissertation in the year 2000. A service that conforms to the REST constraints is referred to as being RESTful. To be RESTful, a service has to conform to the following mandatory constraints.

  1. Client-server constraint, which is based on the separation of concerns, is about separating user interface concerns from data storage concerns. Clients are not concerned with data storage, which is a concern of servers, and servers are not concerned with the user interface or user state, which are concerns of clients.
  2. Stateless constraint is about each request being an independent self-contained unit with all the necessary information for the server to service the request without looking at anything else for the context.
  3. Cache constraint is about the server being able to label a response as cacheable or not,  so that the client handles the response appropriately from the point of view of later use.
  4. Layered constraint is about composing the system into layers, with each layer being  able to see and interact with only its immediate neighbor. A layer cannot see through  its neighbor. Between the client and server, there could be any number of  intermediaries—caches, tunnels, proxies, and so on.
  5. Uniform interface constraint is about providing a uniform interface for identification of resources, manipulation of resources through representations, self-descriptive messages, and hypermedia as the engine of application state.