<?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"
	>
<channel>
	<title>Comments on: REST</title>
	<atom:link href="http://solutions.treypiepmeier.com/2006/09/28/rest/feed/" rel="self" type="application/rss+xml" />
	<link>http://solutions.treypiepmeier.com/2006/09/28/rest/</link>
	<description>So I don't have to figure things out more than once.</description>
	<pubDate>Thu, 03 Jul 2008 23:05:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.2-alpha</generator>
		<item>
		<title>By: Dan</title>
		<link>http://solutions.treypiepmeier.com/2006/09/28/rest/#comment-7438</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Thu, 06 Dec 2007 14:16:21 +0000</pubDate>
		<guid isPermaLink="false">http://solutions.treypiepmeier.com/2006/09/28/rest/#comment-7438</guid>
		<description>&lt;p&gt;No, it's about using the web protocols correctly. For years, people pretended that HTTP is just a way to make Remote Procedure Calls. For example:&lt;/p&gt;

&lt;p&gt;http://example.com/cgi_program.pl?id=3334&#38;dir=foo&#38;cmd=bar&lt;/p&gt;

&lt;p&gt;This has a lot of problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It's not technology independent. What happens when you switch from Perl to Ruby on Rails?&lt;/li&gt;
&lt;li&gt;It's impossible to tell if "cmd=bar" is destructive or not. This affects people trying to cache the results, and affects your error retry strategy.&lt;/li&gt;
&lt;li&gt;It's legal for anyone to switch the order of parameters, so the document has multiple URLs. This affects the efficiency of the cache.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead, it's better to put your "resources" (documents, people, whatever) at the center. This isn't any more difficult to write (at most, one extra config line in your web server, but usually not even that.)&lt;/p&gt;

&lt;p&gt;http://example.com/doc/foo/3334&lt;/p&gt;

&lt;p&gt;If you follow REST, this means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Doing a GET from this URL will never affect the data, so it's safe to cache. It's also idempotent, which means it's safe to restart if there was an error.&lt;/li&gt;
&lt;li&gt;If we want to replace the data, we can do a PUT. To alter the data, we can do a POST. Caches along the way can easily sniff for POST/PUT and realize the document has probably changed.&lt;/li&gt;
&lt;li&gt;You could easily make a read-only version of your private app by having a firewall allow only GET requests.&lt;/li&gt;
&lt;li&gt;The resource (document) has a single URL. This helps later on, when someone builds a mash-up and wants to refer to your documents.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's just scratching the surface. There's a lot more to it. It's one of those "things get simpler if you give yourself some limitations". For example, it might be useful to have a 10ft wide car, but the problems driving down the road would outweigh the benefits.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>No, it&#8217;s about using the web protocols correctly. For years, people pretended that HTTP is just a way to make Remote Procedure Calls. For example:</p>

<p><a href="http://example.com/cgi_program.pl?id=3334&amp;dir=foo&amp;cmd=bar" >http://example.com/cgi_program.pl?id=3334&amp;dir=foo&amp;cmd=bar</a></p>

<p>This has a lot of problems:</p>

<ul>
<li>It&#8217;s not technology independent. What happens when you switch from Perl to Ruby on Rails?</li>
<li>It&#8217;s impossible to tell if &#8220;cmd=bar&#8221; is destructive or not. This affects people trying to cache the results, and affects your error retry strategy.</li>
<li>It&#8217;s legal for anyone to switch the order of parameters, so the document has multiple URLs. This affects the efficiency of the cache.</li>
</ul>

<p>Instead, it&#8217;s better to put your &#8220;resources&#8221; (documents, people, whatever) at the center. This isn&#8217;t any more difficult to write (at most, one extra config line in your web server, but usually not even that.)</p>

<p><a href="http://example.com/doc/foo/3334" >http://example.com/doc/foo/3334</a></p>

<p>If you follow REST, this means:</p>

<ul>
<li>Doing a GET from this URL will never affect the data, so it&#8217;s safe to cache. It&#8217;s also idempotent, which means it&#8217;s safe to restart if there was an error.</li>
<li>If we want to replace the data, we can do a PUT. To alter the data, we can do a POST. Caches along the way can easily sniff for POST/PUT and realize the document has probably changed.</li>
<li>You could easily make a read-only version of your private app by having a firewall allow only GET requests.</li>
<li>The resource (document) has a single URL. This helps later on, when someone builds a mash-up and wants to refer to your documents.</li>
</ul>

<p>That&#8217;s just scratching the surface. There&#8217;s a lot more to it. It&#8217;s one of those &#8220;things get simpler if you give yourself some limitations&#8221;. For example, it might be useful to have a 10ft wide car, but the problems driving down the road would outweigh the benefits.</p>]]></content:encoded>
	</item>
</channel>
</rss>
