Hi David,
On Nov 10, 2005, at 6:14 AM, David Heinemeier Hansson wrote:
One problem with the scheme defined by Donald. It doesn't separate viewing an entity and editing it. So for now, I have edit still happening at person/1/edit, person/1 is showing, and person is the new form. Any thoughts on how to make the show/edit split happen more gracefully?

Also, it makes more sense to have the edit state be the postback than the show stage. Such that its the edit action that shares both showing the form and updating, not the show action.

I agree. I've been wrestling with this question for a while, and my suspicion is that there is a general problem of REST assuming there is only a *single* server-side representation of a resource, e.g.:

        http://host/base/person/1

This is tolerable in an XMLish world where you don't care about human readability and discovery, but not for browser-loving RESTifarians like us. :-)

I believe that the "right" solution in an XHTML-ish ("REX") world is to explicitly allow URL suffixes for alternate representations. Something like:

;http://host/base/person/1/@table :return entity as a <table> row (XOXT) <tr><th scope="col"><abbr title="fn">Full (Formatted) Name</abbr></ td>...</tr>
  <tr id="person.1"><td class="fn">Ernie Prabhakar</td>...</tr>

;http://host/base/person/1/@ol  :return entity as an indexed list (XOXO)
  <ol id="person.1" class="xoxo">
   <li class="fn">Ernie Prabhakar</li>
   ...
  </ol>

;http://host/base/person/1/@dl :return entity as a keyed dictionary (XOXO)
  <dl id="person.1" class="xoxo" >
<dt><abbr title="fn">Full Name:</abbr></dt><dd class="fn">Ernie Prabhakar</dd>
   ...
  </dl>

;http://host/base/person/1/@form  :return entity as a POSTable form
  <dl id="person.1" class="xoxo" >
<dt><label for="person.1.fn"><abbr title="fn">Full (Formatted) Name</abbr></label></dt> <dd><input class="fn" type="text" id="person.1.fn" value="Ernie Prabhakar"/></dd>
   ...
  </dl>

With presumably one of these as the default (no suffix) representation.
The idea is to:
* extend REST to allow multiple server-side representations
* focus on structure ("form") not actions ("edit")
* make it easy to incorporate partials via AHAH with appropriate structure * avoid the need to tweak data templates; use CSS to format the result instead

At least, that's my theory. Thoughts?

http://microformats.org/wiki/rest/rails#URL_Suffix_Proposal

-- Ernie P.





------------
Ernest N. Prabhakar, Ph.D. <drernie at opendarwin.org>
Ex-Physicist, Marketing Weenie, and Dilettante Hacker
Probe-Hacker blog: http://www.opendarwin.org/~drernie/


_______________________________________________
microformats-rest mailing list
[email protected]
http://microformats.org/mailman/listinfo/microformats-rest

Reply via email to