Re: CherryPy and REST: REST vs RPC and CherryPy dispatch methods

Nick Gall <[email protected]>
Newsgroups gmane.comp.web.services.rest
Message-ID <CA+xhAPXfjXMoN0hUus7fF_BPdTRwBA+Q5QtpZxZhiZDx3-w-8Q@mail.gmail.com>
I've never heard that one style of dispatching is more "RESTful" than
another. What most differentiates REST from RPC is the what as known as the
hypermedia constraint. To be fully RESTful (according to the Richardson
Maturity Model[1]), the response generated by the REST interface you are
writing must use a media type that contains "hypermedia controls." With
each interaction with a resource (via the interface you are writing), the
client selects among the hypermedia controls returned in each response to
choose the next interaction it can perform. HTML is only one of many
hypermedia media types containing hypermedia controls.

For a good discussion of hypermedia types (and a list of the popular ones)
see [2]. For a good ranking of the degree of hypermedia-ness
(ie measurement of the level of hypermedia support and sophistication of a
media-type) of various hypermedia types see the hfactor.[3] For a good
example of a JSON-based hypermedia type, see HAL.[4]

[1]  http://martinfowler.com/articles/richardsonMaturityModel.html
[2]  http://amundsen.com/hypermedia/
[3]  http://amundsen.com/hypermedia/hfactor/
[4]  http://stateless.co/hal_specification.html

-- Nick

Nick Gall
Phone: +1.781.608.5871
Other Contact Info: http://bit.ly/nickgall


On Thu, Aug 2, 2012 at 5:41 PM, Dan Stromberg <[email protected]> wrote:

>
>
>
> I just sent this to a CherryPy mailing list (web framework), but I thought
> I should ask the same question here too.  Sorry if I'm re-opening the scab
> on an old flame war!
>
> I've been asked to set up a generic REST interface for a variety of data,
> probably using CherryPy.  We don't appear to have a lot of REST under our
> belts (I know I don't), and I've heard there's a lot of misunderstanding of
> true REST around the internet (getting it conflated with the weaker goals
> of RPC), so naturally, I'd like to see if we can get it (REST) right from
> the start.  Getting it right seems (so far) to boil down to keeping the
> verbs (and adjectives?) out of our URL's, and just letting
> GET/PUT/POST/DELETE be our verbs, sent to noun-nodes in our hierarchy.
>
> We're having a discussion about using CherryPy's MethodDispatcher (CRUD)
> and RoutesDispatcher (whatever you make of it) - and perhaps others, and
> which would be better to encourage true REST.  I caught wind of a meme
> suggesting MethodDispatcher is more RESTful (more "directly" REST) than
> other dispatchers.  Would it be a bad thing to use one and not the other,
> for the sake of REST?  And is REST purity worth bothering with?  Is it a
> goal that often can't be reached 100%, but is still worth striving toward?
>
> Here's a pair of CherryPy Links about how to use MethodDispatcher and
> RoutesDispatcher:
> http://tools.cherrypy.org/wiki/HTTPMethodFiltering
> http://tools.cherrypy.org/wiki/RoutesUrlMatching
>
> Thanks!
>
>
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.