Hi –
Robert W. wrote:
Representational:
The web consists of resources in the form of web pages that are
represented using a Uniform Resource Identifier (URI). REST extends this
definition to refer to other types of resources of an application (i.e.
database tables). Which, can also be represented using a URI.
http://example.com/posts/1 represents the first Post resource in the
posts collection.
A resource in the REST sense isn’t anything as concrete as a database
table, though. It’s more conceptual. As Fielding says: “The resource is
not the storage object. The resource is not a mechanism that the server
uses to handle the storage object.”
State:
This is the current state of the resources.
Transfer (or more precisely State Transfer):
The act of modifying the current state of the resources. Adding a new
one, modifying an existing one, deleting an existing one, etc.
REST defines a convention of using HTTP to both represent and change the
state of resources. That’s a close as I can come to defining
“Representational State Transfer.”
My nutshell take on it is something like this:
A given system gives and receives representations of resources. A
resource is a very high-level construct; a representation is more
specific, and has a content-type and so forth. Resources don’t. (Even
more low-level are matters of storage, which may vary and which are not,
themselves, either resources or representations.)
A resource is always in a given state. Resource states are altered via
the exchange of representations. So if I want to correct the spelling of
my name on a site, I submit a representation of my profile with the new
spelling (probably in the form of a Web form). If I want to make sure
it’s OK, I request a representation (probably in the form of an HTML
document) to inspect.
I’ve written a bit more about this on these blog posts:
http://dablog.rubypal.com/2008/3/23/splitting-hairs-over-resource
http://dablog.rubypal.com/2008/4/24/splitting-hairs-over-resource-part-2
specifically in a Rails context. (Wow, was that more than a year ago?)
David
–
David A. Black / Ruby Power and Light, LLC
Ruby/Rails consulting & training: http://www.rubypal.com
Now out in PDF: The Well-Grounded Rubyist (The Well-Grounded Rubyist)
“Ruby 1.9: What You Need To Know” Envycasts with David A. Black
http://www.envycasts.com