[rest-practices] Atom as a generic container? [was Re: Media types]

Mark McLoughlin markmc at redhat.com
Fri Apr 16 12:40:42 UTC 2010


On Fri, 2010-04-16 at 08:06 -0400, Bryan Kearney wrote:
> On 04/16/2010 05:22 AM, Mark McLoughlin wrote:
> > On Thu, 2010-04-15 at 08:44 -0400, Bill Burke wrote:
> >
> >>   >        application/vnd.rht.rhevm.vm+xml;version=1
> >>   >        application/vnd.rht.rhevm.host+xml;version=1
> >>   >        application/vnd.rht.rhevm.collection.vm+xml;version=1
> >>   >        application/vnd.rht.rhevm.collection.host+xml;version=1
> >>   >
> >>
> >> IMO, the above two are ok.  Atom does it!
> >
> > Okay, you're going to need to help me out here :-)
> >
> > We're talking about the format of the document returned by e.g.
> > 'GET /vms'. At the moment, we're just doing:
> >
> >    <collection>
> >      <vm>
> >      </vm>
> >      ...
> >    </collection>
> 
> 
> I think an xml structure like this will make it harder for any 
> auto-clients such as ruby. I would suggest to get <vms/> as the wrapper.

Yeah, <collection/> is just the JAX-B default from List<VM>

I was tending towards <vms/> anyway, but this auto-clients business
sounds like an actual concrete reason for it ... I'll have to take a
look at that :)

> > You're suggesting using Atom as a generic container format, right?
> >
> > Eoghan suggested something similar here:
> >
> >    https://fedorahosted.org/pipermail/rhevm-api/2010-April/000025.html
> >
> >> application/atom+xml
> >
> > This would just be e.g.:
> >
> >    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> >    <atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
> >      <atom:title>VMs feed</atom:title>
> >      <atom:updated>2010-04-16T09:47:55.288+01:00</atom:updated>
> >      <atom:id>http://{host}/vms</atom:id>
> >      <atom:author>
> >        <atom:name>RHEV-M</atom:name>
> >      </atom:author>
> >      <atom:entry>
> >        <atom:title>vm2</atom:title>
> >        <atom:content>
> >          <vm>
> >            <link rel="self" href="http://{host}/vms/3"/>
> >            <id>3</id>
> >            <name>vm3</name>
> >            <actions>
> >              ...
> >            </actions>
> >          </vm>
> >        </atom:content>
> >
> > That's simple enough:
> >
> >    http://git.fedoraproject.org/git/?p=rhevm-api.git;a=commitdiff;h=3fff835a
> >
> > But now, what about supporting clients who prefer json or yaml? Does
> > "application/atom+json" make much sense, I wonder?
> >
> >> application/atomcat+xml
> >
> > We'd use this to describe e.g. 'vm' and 'host' categories?
> 
> So... one of he items I heard about why REST and not SOAP is that the 
> SOAP envelope is terrible. What I see here is starting to look like such 
> an envelope. Will you be supporting "natrual" xml and json as well?

I'm just exploring what I gather Bill is suggesting. Personally, I think
it looks like a pain in the ass for simple clients to handle

Cheers,
Mark.




More information about the rest-practices mailing list