<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: REST APIs for Batch Operations</title>
	<atom:link href="http://third-bit.com/blog/archives/1746.html/feed" rel="self" type="application/rss+xml" />
	<link>http://third-bit.com/blog/archives/1746.html</link>
	<description>Data is ones and zeroes &#124; Software is ones and zeroes and hard work.</description>
	<lastBuildDate>Tue, 22 May 2012 16:23:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Tapestry and Restlet : unl33t</title>
		<link>http://third-bit.com/blog/archives/1746.html#comment-2238</link>
		<dc:creator>Tapestry and Restlet : unl33t</dc:creator>
		<pubDate>Tue, 12 Jan 2010 21:36:35 +0000</pubDate>
		<guid isPermaLink="false">http://pyre.third-bit.com/blog/archives/1746.html#comment-2238</guid>
		<description>[...] certainly has a couple points of ambiguity, for example batching, but there are options here with various [...]</description>
		<content:encoded><![CDATA[<p>[...] certainly has a couple points of ambiguity, for example batching, but there are options here with various [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: L. Daniel Burr</title>
		<link>http://third-bit.com/blog/archives/1746.html#comment-2237</link>
		<dc:creator>L. Daniel Burr</dc:creator>
		<pubDate>Wed, 17 Sep 2008 02:05:24 +0000</pubDate>
		<guid isPermaLink="false">http://pyre.third-bit.com/blog/archives/1746.html#comment-2237</guid>
		<description>I know the REST camp debates this issue frequently, but in my own applications I just made the decision to support a &quot;transaction&quot; resource; I POST to obtain a transaction id; I PUT the set of operations to be processed in said transaction.  Done.

Admittedly, this doesn&#039;t work for everyone, but it has worked like a charm for my own use cases, and it certainly can work well for the fruit-fly example above.</description>
		<content:encoded><![CDATA[<p>I know the REST camp debates this issue frequently, but in my own applications I just made the decision to support a &#8220;transaction&#8221; resource; I POST to obtain a transaction id; I PUT the set of operations to be processed in said transaction.  Done.</p>
<p>Admittedly, this doesn&#8217;t work for everyone, but it has worked like a charm for my own use cases, and it certainly can work well for the fruit-fly example above.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rhys Ulerich</title>
		<link>http://third-bit.com/blog/archives/1746.html#comment-2236</link>
		<dc:creator>Rhys Ulerich</dc:creator>
		<pubDate>Tue, 16 Sep 2008 23:25:43 +0000</pubDate>
		<guid isPermaLink="false">http://pyre.third-bit.com/blog/archives/1746.html#comment-2236</guid>
		<description>This was a hotly debated/heavily discussed topic between me and a former officemate while doing some SOAP/WSDL API design.  Mike wrote it up quite well: http://www.michaelgilfix.com/techblog/2007/02/25/web-service-interface-design
The API design pattern was used in a high-throughput SOAP-over-HTTP building block underneath telecommunications software.

- Rhys</description>
		<content:encoded><![CDATA[<p>This was a hotly debated/heavily discussed topic between me and a former officemate while doing some SOAP/WSDL API design.  Mike wrote it up quite well: <a href="http://www.michaelgilfix.com/techblog/2007/02/25/web-service-interface-design" rel="nofollow">http://www.michaelgilfix.com/techblog/2007/02/25/web-service-interface-design</a><br />
The API design pattern was used in a high-throughput SOAP-over-HTTP building block underneath telecommunications software.</p>
<p>- Rhys</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liz</title>
		<link>http://third-bit.com/blog/archives/1746.html#comment-2235</link>
		<dc:creator>Liz</dc:creator>
		<pubDate>Tue, 16 Sep 2008 02:20:29 +0000</pubDate>
		<guid isPermaLink="false">http://pyre.third-bit.com/blog/archives/1746.html#comment-2235</guid>
		<description>I don&#039;t have anything technical to add, but I thought I&#039;d drop a comment anyway just to say that your post made me smile because my roommate studies fruit flies.  If you ever need to catch some, I&#039;ve learned some of her lab techniques for escapees, and I could demonstrate with photos.  :-)</description>
		<content:encoded><![CDATA[<p>I don&#8217;t have anything technical to add, but I thought I&#8217;d drop a comment anyway just to say that your post made me smile because my roommate studies fruit flies.  If you ever need to catch some, I&#8217;ve learned some of her lab techniques for escapees, and I could demonstrate with photos.  <img src='http://third-bit.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gavin Terrill</title>
		<link>http://third-bit.com/blog/archives/1746.html#comment-2234</link>
		<dc:creator>Gavin Terrill</dc:creator>
		<pubDate>Tue, 16 Sep 2008 01:48:05 +0000</pubDate>
		<guid isPermaLink="false">http://pyre.third-bit.com/blog/archives/1746.html#comment-2234</guid>
		<description>&lt;a href=&quot;http://dehora.net/journal/2008/02/10/batch-http10/&quot; rel=&quot;nofollow&quot;&gt;REST + Batch&lt;/a&gt; don&#039;t play well right now.</description>
		<content:encoded><![CDATA[<p><a href="http://dehora.net/journal/2008/02/10/batch-http10/" rel="nofollow">REST + Batch</a> don&#8217;t play well right now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Goucher</title>
		<link>http://third-bit.com/blog/archives/1746.html#comment-2233</link>
		<dc:creator>Adam Goucher</dc:creator>
		<pubDate>Tue, 16 Sep 2008 01:18:40 +0000</pubDate>
		<guid isPermaLink="false">http://pyre.third-bit.com/blog/archives/1746.html#comment-2233</guid>
		<description>This might be a clash between Rails and what I think I may know about REST, but...

Single
/api/fly/id, GET
/api/fly/new, POST
/api/fly/id, DELETE

Batch:
/api/flies, GET, {id, id, …}
/api/flies, POST,

The plurality of the name gives it context. It also forces the caller to think about the usage and the access method.

-adam</description>
		<content:encoded><![CDATA[<p>This might be a clash between Rails and what I think I may know about REST, but&#8230;</p>
<p>Single<br />
/api/fly/id, GET<br />
/api/fly/new, POST<br />
/api/fly/id, DELETE</p>
<p>Batch:<br />
/api/flies, GET, {id, id, …}<br />
/api/flies, POST,</p>
<p>The plurality of the name gives it context. It also forces the caller to think about the usage and the access method.</p>
<p>-adam</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rgz</title>
		<link>http://third-bit.com/blog/archives/1746.html#comment-2232</link>
		<dc:creator>rgz</dc:creator>
		<pubDate>Tue, 16 Sep 2008 00:33:39 +0000</pubDate>
		<guid isPermaLink="false">http://pyre.third-bit.com/blog/archives/1746.html#comment-2232</guid>
		<description>This shows what&#039;s wrong with REST, a web api is not like a library but rather a resource like a database server. While I urge you to forgo REST  purity, I suggest you forgo it with style. Considering you update objects PUTting to &quot;/api/fly/id&quot; it makes sense to batch update by PUTting to &quot;/api/fly/id1,id3,id5-id8,id9&quot; basically adding range semantics to REST.

What about it?</description>
		<content:encoded><![CDATA[<p>This shows what&#8217;s wrong with REST, a web api is not like a library but rather a resource like a database server. While I urge you to forgo REST  purity, I suggest you forgo it with style. Considering you update objects PUTting to &#8220;/api/fly/id&#8221; it makes sense to batch update by PUTting to &#8220;/api/fly/id1,id3,id5-id8,id9&#8243; basically adding range semantics to REST.</p>
<p>What about it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Teague</title>
		<link>http://third-bit.com/blog/archives/1746.html#comment-2231</link>
		<dc:creator>Kevin Teague</dc:creator>
		<pubDate>Mon, 15 Sep 2008 23:39:54 +0000</pubDate>
		<guid isPermaLink="false">http://pyre.third-bit.com/blog/archives/1746.html#comment-2231</guid>
		<description>REST creator Roy T. Fielding recently wrote on his blog (http://roy.gbiv.com/untangled/):

&quot;Web architects must understand that resources are just consistent mappings from an identifier to some set of views on server-side state. If one view doesn’t suit your needs, then feel free to create a different resource that provides a better view (for any definition of “better”). These views need not have anything to do with how the information is stored on the server, or even what kind of state it ultimately reflects. It just needs to be understandable (and actionable) by the recipient.&quot;

URLs such as /fly/1, /fly/2, etc. that have a one-to-one mapping from URL to entity are good as a starting point because they are widely understood, but don&#039;t think that by creating another resource to handle batch input for transactional and performance reasons in anyway violates REST principles.</description>
		<content:encoded><![CDATA[<p>REST creator Roy T. Fielding recently wrote on his blog (<a href="http://roy.gbiv.com/untangled/" rel="nofollow">http://roy.gbiv.com/untangled/</a>):</p>
<p>&#8220;Web architects must understand that resources are just consistent mappings from an identifier to some set of views on server-side state. If one view doesn’t suit your needs, then feel free to create a different resource that provides a better view (for any definition of “better”). These views need not have anything to do with how the information is stored on the server, or even what kind of state it ultimately reflects. It just needs to be understandable (and actionable) by the recipient.&#8221;</p>
<p>URLs such as /fly/1, /fly/2, etc. that have a one-to-one mapping from URL to entity are good as a starting point because they are widely understood, but don&#8217;t think that by creating another resource to handle batch input for transactional and performance reasons in anyway violates REST principles.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dethe Elza</title>
		<link>http://third-bit.com/blog/archives/1746.html#comment-2230</link>
		<dc:creator>Dethe Elza</dc:creator>
		<pubDate>Mon, 15 Sep 2008 23:02:39 +0000</pubDate>
		<guid isPermaLink="false">http://pyre.third-bit.com/blog/archives/1746.html#comment-2230</guid>
		<description>This may be obvious, but the poster child for RESTful APIs is the Atom Publishing Protocol (http://bitworking.org/projects/atom/rfc5023.html).  While that spec doesn&#039;t explicitly tell how to PUT multiple items, you can extrapolate from their lists, which GET multiple items.  Simply provide a url that expects a list of items rather than single items.  It can then return a list of the item ids/urls for GET or POST (if editable) as needed.</description>
		<content:encoded><![CDATA[<p>This may be obvious, but the poster child for RESTful APIs is the Atom Publishing Protocol (<a href="http://bitworking.org/projects/atom/rfc5023.html" rel="nofollow">http://bitworking.org/projects/atom/rfc5023.html</a>).  While that spec doesn&#8217;t explicitly tell how to PUT multiple items, you can extrapolate from their lists, which GET multiple items.  Simply provide a url that expects a list of items rather than single items.  It can then return a list of the item ids/urls for GET or POST (if editable) as needed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Handcock</title>
		<link>http://third-bit.com/blog/archives/1746.html#comment-2229</link>
		<dc:creator>Jeremy Handcock</dc:creator>
		<pubDate>Mon, 15 Sep 2008 21:05:06 +0000</pubDate>
		<guid isPermaLink="false">http://pyre.third-bit.com/blog/archives/1746.html#comment-2229</guid>
		<description>Hi Greg,

I&#039;m not sure I fully understand the proposed batch API.  How will clients know which flies were updated?  What happens if an update fails?  How does it solve the problem of possible request timeouts?

Regardless of the architectural style (REST, XML/RPC, etc.), have you considered an asynchronous API?  From what I&#039;ve read in your post, it sounds like you might be better off that way.  The client PUTs a list of flies, it receives a requestId, and then the client polls the server to check the status of the batch request.  When the batch request status is complete, the client can get a report that indicates what fly updates succeeded/failed (if it cares about such things).

So the API would look something like this:

PUT /api/flies {id_0, name_0, genome_0}, {id_1, name_1, genome_1}, …}
RESPONSE {requestId}

GET /api/batchRequest/requestId
RESPONSE {status}, ie. IN_PROGRESS, COMPLETE, FAILED, etc.

GET /api/batchReport/requestId
RESPONSE {report}

Of course you could maintain your original single-fly synchronous API if there are situations where you need it.</description>
		<content:encoded><![CDATA[<p>Hi Greg,</p>
<p>I&#8217;m not sure I fully understand the proposed batch API.  How will clients know which flies were updated?  What happens if an update fails?  How does it solve the problem of possible request timeouts?</p>
<p>Regardless of the architectural style (REST, XML/RPC, etc.), have you considered an asynchronous API?  From what I&#8217;ve read in your post, it sounds like you might be better off that way.  The client PUTs a list of flies, it receives a requestId, and then the client polls the server to check the status of the batch request.  When the batch request status is complete, the client can get a report that indicates what fly updates succeeded/failed (if it cares about such things).</p>
<p>So the API would look something like this:</p>
<p>PUT /api/flies {id_0, name_0, genome_0}, {id_1, name_1, genome_1}, …}<br />
RESPONSE {requestId}</p>
<p>GET /api/batchRequest/requestId<br />
RESPONSE {status}, ie. IN_PROGRESS, COMPLETE, FAILED, etc.</p>
<p>GET /api/batchReport/requestId<br />
RESPONSE {report}</p>
<p>Of course you could maintain your original single-fly synchronous API if there are situations where you need it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

