[uf-rest] Microformats for <form> ?

Dimitri Glazkov dimitri.glazkov at gmail.com
Tue Mar 21 18:38:53 PST 2006


On 3/21/06, Mark Nottingham <mnot at mnot.net> wrote:
>
> On 2006/03/20, at 12:20 PM, Ryan King wrote:
>
> > Also, html forms could be useful for documenting the parameters
> > available on rest resources. Mixed with microformats, as above,
> > this could be a very useful way to document a rest api. It would
> > cover much the same territory as WADL, but in a web-native way
> > which can be very useful to developers, as the forms are a
> > functional sandbox.
>
> Is that really the case? A form seems almost like a choreography to
> me (although I'm fairly ignorant of that world); i.e., it tells you
> how to do one task, rather than document the whole interface.
>
> E.g., if I have a resource that accepts GET, POST, PUT and DELETE,
> the form is probably only going to tickle one of those methods... You
> could put together a set of forms that covered all of the ground, of
> course, but for some tasks, that's pretty clunky.

Let me try this one.

Scenario 1: HTML form provides description of the url-encoded
representation of the resource.

Here we have a resource with two (at least) representations: text/html
and application/x-www-url-encoded. In this case, HTML form acts as the
descriptor of a resource and helps client to build POST/PUT queries,
and even parse GET queries, assuming that we can do a GET for
url-encoded representation (Why? that's a different question). DELETE
doesn't benefit from the form, but neither it needs to.

In HTML4, the only valid method of the form is "POST", but WebForms2
gives us "PUT".

Scenario 2: HTML form provides description of query, available for the
resource (query builder)

In this scenario, the form is not really part of REST. It's just a way
to specify options for modifying (querying) a resource. Naturally,
this one can only be used in conjunction with "GET" method.

Both scenarios can be applied simultaneously to the same resource: one
form is a representation descriptor, the other is the query builder.

:DG<


More information about the microformats-rest mailing list