Web Services (What are REST Web Services)-Part(5)

Stateless REST — (Principle 2)

(All client-server communications are stateless)

  • If the concept of a session is required all information should be stored at the client-side and sent with every subsequent request.
  • This makes every request call from client independent and a complete entity in itself.

Caching — (Principle 3)

In the previous concept, we saw that the server does not maintain the state of the session. In that case how the client and the server communicate when passing requests and responses. For that, we can use caching and the caching happens at the client-side. So whenever a client sends a request to the server the server gets that request which contains the actual data and along with the actual data, there is some other metadata (some information in the headers) and which tests the client whether the client has to cache the response or not.

Layering — (Principle 4)

The communication between Client and Server 4th Principle says that there can be multiple layers between communication. These layers can be HTTP intermediaries and they can be used for a number of purposes. They can be used for message translation, improving performance, caching, etc.

Code-on-demand (Principle 5)

This is an optional constraint of REST Web Services. So it is something like when you send a request and get back the response. The response has an ability to run some code or some JavaScript on the client-side.

Summary

REST means that every resource can be represented in multiple ways. So resources have a representation in XML or JSON format.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store