« Return to Thread: Our REST implementation

Re: Our REST implementation

by weierophinney :: Rate this Message:

Reply to Author | View in Thread

-- till <klimpong@...> wrote
(on Tuesday, 29 May 2007, 03:55 PM +0200):
> On 5/28/07, Shahar Evorn <shahar.e@...> wrote:
> > I did some more reading on this and it really does seem that our
> > Rest_Server is more RPC oriented (eg. method focused and not resource
> > focused) web service implementation.
>
> I had this discussion with a friend a while ago. I am not sure where
> we left of - so can you provide an example where REST is less RPC and
> more like ... whatever it is supposed to be? ;-))

Well, there's always the dissertation that started it all:

    http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm

Note particularly Chapter 5, which describes the REST implementation.

I've also found the following to be a good description of REST:

    http://www.xfront.com/REST-Web-Services.html

The difference between a classic REST implementation and traditional RPC
services is that REST is very resource centric, and uses the HTTP
request itself as the verb: i.e., GET, POST, DELETE, PUT. As an example,
instead of something like:

    http://example.com/rest?method=foo¶m1=bar¶m2=baz

which might invoke the 'foo' method on the remote server with the
parameters 'bar' and 'baz', you'd be more likely to think in terms of,
"I want to get the bar resource from the foo service":

    http://example.com/foo/bar

and calling

    http://example.com/foo

would return all resources of the foo service, while POSTing to
http://example.com/foo/bar would modify that resource.

So, in this regards, the Zend_Rest_Server in ZF is definitely more
RPC-like -- it maps URLs to existing *actions* on the server. Many see
this as a valid REST style; others don't.

If you want to do a more classic RESTful service, you can actually do so
quite easily using the MVC layer; you'd create a controller for the
resource, map URLs to it using the rewrite router, and then in your view
scripts create and return XML instead of XHTML.

--
Matthew Weier O'Phinney
PHP Developer            | matthew@...
Zend - The PHP Company   | http://www.zend.com/

 « Return to Thread: Our REST implementation