in reply to Re: How do I create friendlier URLS?
in thread How do I create friendlier URLS?

By the true definition of REST, that's not a pure REST interface. One of the principles of REST is to not use any verbs in your resource name because the HTTP request is the verb.

To make your app truly RESTful, use page/10 instead of loadPage/10. An HTTP GET request should signify "load", HTTP DELETE for "delete", and so forth.

There is some dissonance on whether POST or PUT should be used for insert or update, but the idea is that the HTTP request provides the "verb", not the resource name.

And then, I haven't even touched on mime-types :)

Here's some more info: Wikipedia article on REST

Replies are listed 'Best First'.
Re^3: How do I create friendlier URLS?
by rhesa (Vicar) on Feb 22, 2007 at 18:44 UTC
    You're quite right about all of that, and I have applied those principles to my REST interface at work. But I didn't say the examples for the OP were REST :-)

    CGI::Application::Dispatch has some extra features to make REST easier to implement (by attaching the HTTP verb to the runmode name, so you'd have page_GET, page_DELETE etc. as the real run modes, dispatched from the single /page url). I don't think it's relevant to the OP's question though, and would probably confuse the issue.

    By the way, I really, really like the REST approach. It encourages a clear, uncluttered implementation on the backend, and it's very simple to integrate the resulting resources into other applications. Compared to SOAP, REST is a lot cleaner ;)

    I also found the columns on xml.com helpful in gaining a more practical understanding of the REST philosophy.