hypermedia - seriously
Updated: 2008-04-28
Check out the follow-on post where i offer a possible example of a new
application/hypermedia+json
media type.
ok, for the last week or so, i've been struggling with the details of internalizing the last item in this quote from Fielding's dissertation (2000):
REST is defined by four interface constraints: identification of resources; manipulation of resources through representations; self-descriptive messages; and, hypermedia as the engine of application state.
there are several articles on this last point and lots of back-and-forth about what it means, etc. but, i'm not focused on that right now. i *am* focused on a proper *implementation* of "hypermedia as the engine of appilcation state." and that means creating hypermedia resources that are consumed by hypermedia-aware clients. and that's where it gets tricky.
so, what is an example of a hypermedia document? (X)HTML. simple. it can contain simple hypermedia links generated by the server (tags with the "href
" attribute). (X)HTML also has a standard for sending resource from the client to the server (the FORM
element with it's "action
", "method
", and "enctype
" attributes). cool. i understand that. i also understand the general principle of making the "href" and "action" attributes opaque in order to allow servers to dynamcially compose them based on the interaction between client and server. all nice. and it works quote well.
and *why* does it work well?
because the common client implementation for (X)HTML understands the media-type well enough to be able to render these hypermedia elements (links and forms) properly. see, it's the client, isn't it?
now consider creating REST-ful applications that use JSON as the resource representations. where is the hypermedia ("links" and "forms")? what standardized clients understand how to render these elements properly? and what about the various flavors of XML (Atom, RDF, etc.)? where are the widely-known, standardized clients that understand the hypermedia of Atom and RDF?
actually, JSON is not a media-type. it's a serialization type. like XML. Atom is a media-type that uses XML. i can see that. but are there really Atom clients? or are there Atom applications?
so it really is about the client. we need "hypermedia clients" that use Atom, JSON, and other media-types.
anyone got one?