OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] RESTful XML for updates?

In a RESTful system, any thing that you want to be able to address
independently (e.g., the widget's state or color) should be an
independent resource with its own URL. If you simply want to query the
thing, and it's a child of another resource, you can use a query URL,
but if you want to update it, it should be a stand-alone URL.

Bear in mind that the XML document is a logical representation of the
widget resource, and the means by which you maintain it's state on the
server should be invisible to the client. It's possible that you also
use this XML document as the physical representation of the resource,
but you should maintain a separation of concerns between the logical
and physical worlds. When a user updates a widget's state or color,
your backend process should make the appropriate changes to the server
side state on behalf of the client.

On 3/6/09, Elliotte Harold <elharo@metalab.unc.edu> wrote:
> Scott, Christopher wrote:
>> Hello all,
>> 	I'm putting together a RESTful webservice and I wanted to get
>> some input about how one would design XML resource representations.  The
>> question has to deal with designing the resource with updates in mind.
>> I've googled for examples but most articles outline what a resource
>> should look like, but not how it should be updated.
>> I would like to be able to update a representation without having to PUT
>> the entire resource representation back to the server.  For example,
>> consider a simple resource which resides at a URL /Widget/001
>> <Widget>
>>   <Id>0FAB7894C</Id>
>>   <CreatedDate>2009-03-05</CreatedDate>
>>   <State>INSPECTED</State>
>>   <Color>Blue</Color>
>>   <Whatsists>
>>     <Whatsist href="/Whatsist/1002"/>
>>     <Whatsist href="/Whatsist/1002"/>
>>   </Whatsists>
>> </Widget>
>> I'd like the client to be able to change the color or state of this
>> widget to, say REJECTED, but not be able to change the id, or the
>> CreatedDate.
> Don't be afraid of having lots of URLs. In this case, I would also
> define a URL at /Widget/001/Color to which you could PUT just the color.
> I'm not sure about the best answer as to indicating which fields are
> updateable. perhaps a separate custom document indicating this?
> --
> Elliotte Rusty Harold  elharo@metalab.unc.edu
> Refactoring HTML Just Published!
> http://www.amazon.com/exec/obidos/ISBN=0321503635/ref=nosim/cafeaulaitA
> _______________________________________________________________________
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS