Fwd: [rest-discuss] hateoas - draft #1

This thread on rest-discuss<http://tech.groups.yahoo.com/group/rest-discuss/>discusses the relationship between a *resource* and its *representations*. It's a core REST tenet and it's important that it's well understood: Modeled resources e.g. people, bank accounts, computers, etc. (generally) can't be transferred over HTTP. As such we rely on "representations" which convey information describing the resource - for a person it might be a photo, XML descriptor, rendering of a drivers license or other ID, fingerprints, DNA sequence, etc. - none of these are the actual person but they all describe some characteristic(s) of them. Updating the person's name by posting a representation of their drivers license should result in updates to the person's passport and XML descriptor. In relation to OCCI it may be possible to create a VM by PUTting an OVF file and it may also be possible to GET representations in other formats - e.g. Xen, Hyper-V, VMware. Just because you can render a representation doesn't guarantee that you can read it however so updates using an unsupported format should trigger a 415 Unsupported Media Type error. Sam ---------- Forwarded message ---------- From: Sam Johnston <samj@samj.net> Date: Fri, Oct 16, 2009 at 1:34 PM Subject: Re: [rest-discuss] hateoas - draft #1 To: Mike Kelly <mike@mykanjo.co.uk> Cc: Jan Algermissen <algermissen1971@mac.com>, Will Hartung < willh@mirthcorp.com>, "rest-discuss@yahoogroups.com List" < rest-discuss@yahoogroups.com> On Fri, Oct 16, 2009 at 1:05 PM, Mike Kelly <mike@mykanjo.co.uk> wrote:
PUT /resource.xml
what does that mean for
/resource.json /resource.atom
.. How would intermediaries know that the state of the json and atom resources (that are really just representations of the same resource) have also changed?
Well, if you PUT some XML to a resource and it response with 2xx then there will not be any json or atom anymore because you told the server to explicitly replace whatever state the resource has with the XML.
I believe this to be a fundamental misinterpretation of what it means to PUT a representation. The significance of the request is to update the *resource* state by transfering an XML representation - this should not cause other the other representations to cease to exist. That doesn't make sense to me if they are simply representations of the resource that has been updated - regardless of which specific representation caused the update.
Exactly. As another example, if an OCCI <http://www.occi-wg.org/>implementation supports multiple formats for virtual machines (say, OVF, Xen and Hyper-V) then PUTting (or PATCHing<http://tools.ietf.org/html/draft-dusseault-http-patch>) any one of these formats will update the *resource* and with it all of its representations. If the support is export-only (that is, it is able to render the resource to it but not parse and update the resource from it) then such requests should be rejected with e.g. 415 Unsupported Media Type. Sam
participants (1)
-
Sam Johnston