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...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

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
RESTful representation of side effects?   Message List  
Reply | Forward Message #5838 of 14029 |
Re: [rest-discuss] RESTful representation of nouns?

On Apr 5, 2006, at 5:31 PM, Dr. Ernie Prabhakar wrote:

> Thanks, Nic, Roy. The fog is clearing slightly. :-) The key issue
> appears to be:
>
> On Apr 5, 2006, at 4:26 PM, Roy T. Fielding wrote:
>> OTOH, a translation service like
>>
>> /convert?format=pdf
>>
>> can simply be a POST of file-upload with the response being the
>> converted representation.
>>
>>> However, that doesn't seem very RESTful.
>>
>> Why? POST is RESTful too, when it is used correctly.
>
> This is what confuses me. My (naive) understanding is that every
> URI represents a noun, that is, a resource. The URL:
>
> http://myhost.com/convert
>
> seems like it represents a verb, especially when given parameters:
>
> http://myhost.com/convert?format=pdf

Places are nouns, too. All you are doing is giving the URI of a service
that performs stateless conversions. The GET interface simply tells you
how to use the service (e.g., HTML form), there is no other resource
involved, and there is no sustained benefit across multiple invocations
(no reusable resources other than the service itself).

I hate to quote myself, but in sec 5.2.1.2:

"REST components perform actions on a resource by using a
representation to capture the current or intended state of that
resource and transferring that representation between components."

so what you have defined above is a one-resource RESTful service that
merely reflects a different shade of state back to the client.

> or even when given other nouns:
>
> http://myhost.com/convert?format=pdf&uri=http//example.com/
> get_it_here.html

That's a different beast -- it is a gateway, and it would "look"
more RESTful simply by choosing a different URI syntax, e.g.

http://myconverter.com/pdf/http://example.com/get_it_here.html

(naming scripts, including .cgi, and using path components versus
query parameters are all equivalent aside from some caching heuristics).
The presence of that gateway provides a parallel world of resources
(hopefully they would have the sense to block their own site
from being included within itself).

I guess you could say that is a more RESTful service than one that
only converted the input of forms. [OTOH, I am not entirely convinced
that "RESTful" is a meaningful term, since for me REST is a particular
architectural style with black&white constraints, whereas I use the
term "principled design" for discussion of tradeoffs. *shrug*]
I guess "more resources" would have to be "more RESTful".

> So, if I read Roy correctly, the service described by that URL is
> -- or at least could be -- RESTful. Does this mean that the belief
> "URLs must represent nouns" is a complete myth? Or is there
> something else going on here?

Don't get carried away. You won't find a constraint about "nouns"
anywhere in my dissertation. It talks about resources, as in
*re*sources, because that is what we want from a distributed
hypermedia system (the ability to reuse those information sources
through the provision of links). Services that are merely end-points
are allowed within that model, but they aren't very interesting
because they only amount to one resource. The really interesting
services provide many resources.

Note that this is just another way of restating Reed's law in
relation to Metcalfe's law.

http://en.wikipedia.org/wiki/Reed%27s_law

....Roy



Thu Apr 6, 2006 2:01 am

roy_fielding
Offline Offline
Send Email Send Email

Forward
Message #5838 of 14029 |
Expand Messages Author Sort by Date

Hi all, I'm taking my quarterly run at trying to properly grok REST, and as usual have only succeeding in confusing myself. :-) Perhaps you can help. I want...
Dr. Ernie Prabhakar
sandhyaprabh...
Offline Send Email
Apr 5, 2006
10:37 pm

... How about - you send: POST /documents Content-type: text/html --header-end-- <html> to be converted </html> you get back: HTTP/1.1 201 Created Location:...
Nic
nferrier_tap...
Offline Send Email
Apr 5, 2006
11:24 pm

Hi Ernie, ... That is confusing. Why "document=mydocument.html"? Is the server translating the input file or is it getting the file from somewhere else? I...
Roy T. Fielding
roy_fielding
Offline Send Email
Apr 5, 2006
11:26 pm

Thanks, Nic, Roy. The fog is clearing slightly. :-) The key issue appears to be: ... This is what confuses me. My (naive) understanding is that every URI ...
Dr. Ernie Prabhakar
sandhyaprabh...
Offline Send Email
Apr 6, 2006
12:41 am

... /mydocument.html/pdf Alternative if the service is on the same domain. All */pdf patterns map back to the code that renders out the pdf and take the rest...
Bill de hÓra
bdehora
Offline Send Email
Apr 6, 2006
12:56 am

... IMHO, It _is_ a noun. I think you're being misled that "convert" somehow makes the URL less valid than "/mydocument.html/pdf", proposed by Bill. What does...
Dimitri Glazkov
dimitriglazkov
Offline Send Email
Apr 6, 2006
1:49 am

... Places are nouns, too. All you are doing is giving the URI of a service that performs stateless conversions. The GET interface simply tells you how to...
Roy T. Fielding
roy_fielding
Offline Send Email
Apr 6, 2006
2:01 am

... http://myhost.com/convertor ? The whole verb-in-the-URI-thing is just a rule of thumb that I found seemed to help some brought-up-on-RPC types I know to...
Mark Baker
gonga_thrash
Offline Send Email
Apr 6, 2006
2:05 am

Hi everybody, ... Thanks for all the comments, they all helped add a little bit of ... So, services (even those that look like verbs) can be stateless ...
Dr. Ernie Prabhakar
sandhyaprabh...
Offline Send Email
Apr 6, 2006
2:17 am

... Er, services that "look like verbs" are just confusing -- the question is whether they behave according to the uniform methods applied to them or not. If...
Roy T. Fielding
roy_fielding
Offline Send Email
Apr 6, 2006
3:49 am

... Oh that's just nomenclature. Try: http://myhost.com/mydocument instead. Nic...
Nic
nferrier_tap...
Offline Send Email
Apr 6, 2006
9:27 am

... REST is a model for managing state mutation and transfer in a large scale distributed architecture. People often get caught up in whether a simple...
Benjamin Carlyle
fuzzybsc
Offline Send Email
Apr 6, 2006
3:12 pm
Advanced

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