I have been investigating REST for the last few days, trying to understand how it works, and what it takes to be implemented. I'd like to use it for implementing yet another web application, as I see it as a very efficient way of communicating.
However, I would like my application to do not only the REST part but also the web server part, ideally using the identical URI. So if it's a script talking to the REST interface, just a very basic chunk of XML will get returned, but if it's a browser, then it will get a menu, nice CSS, header, footer and all of the other amenities you normally see on a web page.
- One alternative is to use a modifier on the URI as Perl Monks does: just add displaytype=xml and get the stripped down version.
- Another alternative is to put the REST stuff in a sub-directory, so the URI goes first to /rest and then on to /project/foobar.
- I could also add in my own header field into the request, and just have the handler Do The Right Thing
There may be other approaches .. I'd be interested in hearing from you about any other ideas or thoughts.
Oh, and here's some reading material for those of you interested in REST:
- eBay's Developer program
- A Canadian government REST project
- REST based authentication, a paper that's linked to by about half of the results that Google found for me
- http://rifers.org/wiki/display/BLA/REST+API
- http://www.kbcafe.com/rss/?guid=20060704042846
- a really neat discussion
Also, I installed REST::Application -- quite a nice piece of code, and the note I sent to the author got a reply very promptly, always encouraging. It's written for Apache 1.3, and I'm using Apache 2.0, so it didn't work for me. I may just write my own code to disassemble the requests and dispatch them.