Search the web
Sign In
New User? Sign Up
rest-discuss · REST Discussion Mailing List
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want your group to be featured on the Yahoo! Groups website? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
REST is not just file storage   Topic List   < Prev Topic  |  Next Topic >
Reply | Forward  | 
Re: [rest-discuss] REST is not just file storage

On May 6, 2008, at 1:06 AM, dev wrote:
> >want to know how to do everything in a PUT or DELETE instead of
> >any of the other HTTP methods. That is wrong. That is thinking
> >HTTP is just a "Save as..." dialog.
>
> At first I thought that using non-standard methods like PATCH would be
> wrong as it wouldn't allow for serendipitous reuse.
>

Serendipitous reuse comes from providing a URI for everything that is
of value as a resource (even when that value is not used by your own
application). As long as you are using GET for retrieval, then reuse
will be there. POST can be used in serendipitous ways as well, but
there are no special tricks in HTTP that make POST actions any more or
less reusable than any form of RPC/RMI -- we simply rely on the
media type telling us where to POST to describe the service on the fly
(late-binding is always better than compiled contracts because any
late binding can self-identify its own expected "contract").
More importantly, it is very hard to see that it is safe to reuse
a POST in unforeseen ways, whereas that is required of GET.

Even when POST is used to perform the equivalent of GET, for whatever
crazy reason, it can be compensated somewhat by responding to the POST
with 303 or 201 + Location, or simply by limiting the 200 response
content to a list of references to reusable resources.

PUT, DELETE, and PATCH are essentially editing operations on the
mapping from URI to representation. In many cases, those will translate
down to what is essentially file-like CRUD operations, but only for
a very small subset of resources. If you think of it in MVC terms,
then those operations should only be active when M=V. It is the
application's job to determine when M=V; i.e., which models are
capable of being edited by representation exchange, which models can
be edited by indirect action on some other resource(s) (e.g., edit
links in Atom or wiki post forms on pages), and which models can't
be edited at all via HTTP.

In any case, there are plenty of RESTful services that do nothing
but GET and POST. The key is how those methods are used, not what
methods are used. To give a specific example, what makes a wiki
more or less RESTful is almost always determined by how it (ab)uses
GET and sessions -- whether it uses PUT or POST for editing pages
is sugar topping in comparison.

> But what you are
> saying is using non-standard methods is fine as long as there is an
> engine which can tell the client what to do next. That engine should
> support introspection via GET. Is this correct ?
>

I wouldn't go as far as saying all "non-standard methods" are fine.
The methods still need to be standardized in order for intermediaries
to take part in the conversation and for generic clients to know how
to follow the instructions. The methods still need to be resource-
neutral
in terms of semantics. However, for actions that do not benefit
from intermediaries (non-retrieval actions), the focus of REST is to
make the results visible as reusable resources after the action is
complete rather than worry too much about the standard-ness of any
non-GET method name.

....Roy



Tue May 6, 2008 9:57 pm

roy_fielding
Offline Offline
Send Email Send Email

Forward
 | 
Expand Messages Author Sort by Date

There seems to be a common thread with most posts here. People have been busy modeling everything as a resource and now they want to know how to do everything...
Roy T. Fielding
roy_fielding
Offline Send Email
May 5, 2008
9:17 pm

Yes! And it's not just here -- this same take on REST can be found all over the web. For some reason, people just don't appreciate the hypermedia engine aspect...
wahbedahbe
Offline Send Email
May 6, 2008
5:23 am

... At first I thought that using non-standard methods like PATCH would be wrong as it wouldn't allow for serendipitous reuse . But what you are saying is...
dev
bertie_woost...
Offline Send Email
May 6, 2008
8:06 am

... Serendipitous reuse comes from providing a URI for everything that is of value as a resource (even when that value is not used by your own application)....
Roy T. Fielding
roy_fielding
Offline Send Email
May 6, 2008
9:57 pm

... Along with addressability , isn't a uniform interface necessary too[1] ? I am not saying uniform interface means that PUT should always do this , DELETE...
dev
bertie_woost...
Offline Send Email
May 7, 2008
10:07 am

... My understanding (and I'm sure I'll get corrected if I'm wrong) is that the interface is uniform due to the way the service tells the client what...
Andrew S. Townley
adz1092
Offline Send Email
May 7, 2008
10:28 am

... Anyone remembers Royce and the Waterfall Model? In a 1970 he criticed the waterfall approach and argued for iterative development. Most people's take...
Assaf Arkin
assafarkin
Offline Send Email
May 6, 2008
11:06 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help