What are RESTful Web Services
REST is an architectural style which was brought in by Roy Fielding in 2000 in his doctoral thesis. Any software, technology adhering with the defination of REST would be considered as REST based. So, in the context of Web Services, RESTful Web Services are the one which supports REST concept.
What are RESTFull Web Services:
RESTFull Web Services refers to a stateless client-server architecture in which the Web Services (data, functionality on server side) are considered as resources and can be accessed using their uniform Resource Identifiers (URI’s).
The response from server is considered as the representation of the resources. This representation can be generated from one resource or more number of resources.
So, in RESTful Web Services, Server is viewed as a set of resources and can be accessed using Uniform Resource Identifiers (URIs).
In the REST architectural style, clients and servers exchange representations of resources by using a standardized interface and protocol. HTTP protocol best describes REST, so all the existing vendors are supporting RESTfull Web Services using HTTP protocol. But, as such any other protocol can be used to realize RESTfull Web Services as long as it adheres with the REST principles.
A resource can be any coherent and meaningful concept that may be addressed e.g an entry of student record in the database with roll number (23) as a primary key etc. A representation of a resource is typically a document that captures the current or intended state of a resource e.g HTML page, PDF etc.
But, only thing to be noted is, this resource must be having a unique URI (like
https://www.school.com/studentRecord/rollnum=23), which a client would use to access it.
Following are the features of RESTful Web Services:
- Client directly access a Resource using its URI: Resources are identified by their URIs (typically links on internet). So, a client can directly access a RESTful Web Services using the URIs of the resources (same as you put a website address in the browser’s address bar and get some representation as response).
- Uniform interface: Resources on the server can be manipulated by a client using a fixed set of four create, read, update, delete operations: PUT, GET, POST, and DELETE. PUT creates a new resource, which can be then deleted by using DELETE. GET retrieves the current state of a resource in some representation. POST transfers a new state onto a resource.
- Self-descriptive messages: Resources are decoupled from their representation so that their content can be accessed in a variety of formats, such as HTML, XML, plain text, PDF, JPEG, JSON, and others. Metadata about the resource is available and used, for example, to control caching, detect transmission errors, negotiate the appropriate representation format, and perform authentication or access control. Every such information will be available in the message itself.