Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does Representational State mean in REST?

I have been reading all over the net to get the exact meaning of two words:

REPRESENTATIONAL STATE

I have a doubt. I am misunderstanding these terms. i want to clarify understanding with some one how has good idea about this.

My understanding is that, there is a resource located in the server. SO Rest means that, transferring some representational state of this resource to a client.

if server has a resource x, then if we can make representational state y of resource x, and transferring it over the web is what REST means, is this correct or what is the correct meaning of it. could some one explain me this.

like image 480
KItis Avatar asked May 02 '12 16:05

KItis


People also ask

What is representational in REST API?

Representational state transfer or simply REST is a term for exchanging data in well-defined formats in order to increase interoperability. Through application of certain constraints decoupling from clients to servers should be achived which make the former one more robust and the latter one more flexible to changes.

What is representational state transfer REST used for?

REST, short for representational state transfer, is a type of software architecture that was designed to ensure interoperability between different Internet computer systems. REST works by putting in place very strict constraints for the development of web services.

Why is REST API called representational state transfer?

REST (Representational State Transfer) is an architectural style for designing decentralized systems. It originated from an architectural analysis of the Web and combines a client/server architecture with additional constraints that define a uniform interface.

What is REST REST is an acronym for Representational State Transfer?

REST is an acronym for REpresentational State Transfer and an architectural style for distributed hypermedia systems. Roy Fielding first presented it in 2000 in his famous dissertation. Like other architectural styles, REST has its guiding principles and constraints.


2 Answers

Although REST is stateless, it has state transfer in its name. It's a little bit confusing to everyone.

Stateless

When you open a web page in the browser, you will act as a service consumer and the www server will act as a service provider to serve you with a webpage. If it is a normal connection, the client and the server will both perform a handshake and initiate a session (called a TCP connection).

After that, based on the server's and client's behavior, the state will change to either ESTABLISHED, IDLE, TIMEOUT, etc. But in REST, we are using the HTTP protocol which is a stateless, meaning the server will not store any session information about the client. The client is responsible for sending all of the details required by the server to get serviced, meaning when we invoke the URI http://somedomain:8080/senthil/services/page1 from the server, it has enough details about the client to serve page1 fully.

State Transfer

Using the same example, when you open a web page using some URL to view an image file (RESOURCE) on the server,the www server will show you (the client) the image in some format i.e a REPRESENTATION of the RESOURCE (image file).

During this process, the constant resource state of the server (i.e. the state of the image file which is stored in the server database) will be represented to client in an understandable format i.e. application state of the client. So, the resource state will remain constant in respect to clients, and only the representation of the resource will change, which in turn would change the application state.

Finally, the representation of the resource (how the image is displayed to the client), which implicitly changes the state of both the server and the client is called REST.

like image 117
Senthilkumar Ramasamy Avatar answered Oct 05 '22 05:10

Senthilkumar Ramasamy


Representational State Transfer refers to transferring "representations". You are using a "representation" of a resource to transfer resource state which lives on the server into application state on the client.

like image 45
Darrel Miller Avatar answered Oct 05 '22 04:10

Darrel Miller