Sample bartleby Q&A Solution
You ask questions, our tutors answer
Browse
Question

What are REST web services and what is the reason for its popularity?

Expert Answer

  • REST stands for Representational State Transfer and is an architectural style for most web based applications and apps better known as web services today.
  • Being mostly based on HTTP which is the default web networking protocal both service provider and the service consumer benefit in terms of usability, accessibility, availability and scalability.
  • REST protocol is stateless and not conversational in nature as explained below.
  • REST based web services enable access to resources such as pictures, videos, files, web pages, business data, etc.
  • REST does not dictate message format and offers flexibility in terms of popular web formats such as JSON, XML.

 

The resource which is denoted by the REST based service must be represented completely in a single self-contained message. This enables a stateless message protocol where a back and forth communication is not required. Every message request is for a single resource and the reply is the complete resource and the session is deemed complete with the reply.

This is in contrast with a conversational or chatty message protocol such as a dedicated long running session between a client and the server in a traditional client server architecture. Here the communication protocol is kept live after the first round of message exchange and the server is kept aware of the state of the client.

An example of a resource request (details of employee with ID=5555) would look something similar to what is given in the diagram.

The response might look as given in the diagram (XML format and showing just the HTTP response body). So an employee record for a particular employee is a single resource which is being fetched.