Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does “state transfer” in Representational State Transfer (REST) refer to?

Tags:

What does the State Transfer in Representational State Transfer refer to?

Found some explanations about this (e.g. here) but I still don't understand. For example in the article it is said

The representation places the client application in a state.

Why? What does state (as I understand it, something like a session) have to do with a representation of a resource?

like image 968
user2011 Avatar asked Jan 05 '11 11:01

user2011


1 Answers

Why? What does state (as I understand it, something like a session) have to do with a representation of a resource?

An object has attributes (or state) and behaviors (or methods).

If I want to move an object from my desktop to a server I have to do the following:

  1. Create a representation of the state of the object.

  2. Transfer that representation from the desktop to the server.

The methods I don't transfer. I install the same class definition on both machines.

So, REST is about creating a representation of the object's current state so it can be transferred to another server from which the object can be reconstructed.

We only send the state -- the attributes -- of the object. And we have to create an external, serialized representation of that state.

like image 108
S.Lott Avatar answered Sep 27 '22 20:09

S.Lott