[rest-practices] text/html representation?

Bryan Kearney bkearney at redhat.com
Wed Apr 28 12:56:10 UTC 2010


On 04/28/2010 08:37 AM, Mark McLoughlin wrote:
> Yeah, I was thinking along similar lines
>
> With html, a form describes the parameters which can be POSTed
>
> Does a RESTful API need something similar for parameters to an action
> link?
>
> We had been assuming any action parameters would be passed using an
> xml/json/etc. representation of the "action resource", but if we take
> the html form analogy, we could actually pass them using query
> parameters using application/x-www-form-urlencoded as you say
>
> I'm thinking along the lines of:
>
>    <vm>
>      ...
>      <actions>
>        <action rel="reboot" href="..."/>
>          <input name="async" type="bool"/>
>          <input name="foo" type="enum>
>            <option>FOO_BAR</option>
>            <option>FOO_BLAA</option>
>          </input>
>        </action>
>      </actions>
>    </vm>
>
> After looking at it, though, I'm coming back full circle because:
>
>    - HTML forms accept encodings other than urlencoded - likewise,
>      there's no reason to restrict ourselves to urlencoded
>
>    - The example form above starts to look like a schema - so, why not
>      just have a real XML schema for the representation accepted by the
>      action link
>
> With the text/html representation of a resource, though, it would make
> sense to represent action links with a<form>  generated from the XML
> schema for the action representation
>

I tend to think that html == display. I like the fact that the REST 
engine is no gui.

-- bk




More information about the rest-practices mailing list