[rest-practices] ID as an attribute [was Re: [deltacloud-devel] Towards declaring the Deltacloud API stable]

Mark McLoughlin markmc at redhat.com
Wed May 12 09:44:30 UTC 2010


On Thu, 2010-05-06 at 21:47 +0100, Mark McLoughlin wrote:

> Related, with the RHEV-M API we're experimenting with making both the
> id and href attributes, which would work out nice here:
> 
>   GET /api/images HTTP/1.1
> 
>   <images>
>     <image id="1234" href="/api/images/1234"/>
>     <image id="9876" href="/api/images/9876"/>
>     ...
>   </images>
> 
> rather than:
> 
>   GET /api/images HTTP/1.1
> 
>   <images>
>     <image href="/api/images/1234">
>       <id>1234</id>
>     </image>
>     <image href="/api/images/9876">
>       <id>9876</id>
>     </image>
>     ...
>   </images> 

Just wanted to bring this up again - it got lost in the mix

I don't feel very strongly about it either way, but I do prefer:

  POST /storagedomains/1234/attachments HTTP/1.1

  <attachment><datacenter id="5678"/></attachment>

over:

  POST /storagedomains/1234/attachments HTTP/1.1

  <attachment><datacenter><id>"5678"</id></datacenter></attachment>

Cheers,
Mark.




More information about the rest-practices mailing list