[occi-wg] Syntax of OCCI API
richard.davies at elastichosts.com
Thu Apr 16 07:44:38 CDT 2009
Sam Johnston wrote:
> What I've done so far is based it on an extremely simple, well specified
> and common XML structure (Atom - RFC 4287) and (following Sun's example)
> embedded links for operations:
> These links can obviously be actuated by any HTTP client and they could
> obviously be embedded in a format of your choice (e.g. json).
The links for operations look good - a simple HTTP POST to a straight url.
I'm more concerned about the Atom XML. I agree that what you've done is a
decent implementation of standard Atom XML, but am worried about the amount
of overhead which this has introduced.
Looking at the sample code on the wiki at present, this is currently 2778
characters spread over 53 lines, using 5 xml namespaces and around 20-30 xml
tags with up to 7 levels of indentation. And it's explicitly abbreviated
with a '...'.
What this code actually does is return a handful of details about a single
virtual machine. If I only list the actual data fields then we have:
<title>Debian GNU/Linux 5.0 Virtual Appliance</title>
<summary>Base installation of Debian GNU/Linux 5.0</summary>
<disk id="file1" href="virtual-disk.vmdk" size="148251374"/>
<meter rate="0.10" currency="USD" unit="hours">35.27</meter>
That's 575 characters over 15 lines with 14 tags in 1 namespace and 1 level
of indentation. It is now simple enough that I could trivially parse it or
generate it from any programming language without any libraries if
necessary. The equivalent JSON is also obvious and simple.
Both the ElasticHosts and GoGrid APIs are written much more in this second
style of syntax - which is what we mean by a "design pattern B" - work out
exactly what data is needed for each operation and write down exactly this
with the absolute minimum of syntax overhead.
More information about the occi-wg