<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Backdrifter &#187; rest</title>
	<atom:link href="http://www.backdrifter.com/tags/rest/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.backdrifter.com</link>
	<description>The personal site of Jared Hanson</description>
	<lastBuildDate>Tue, 22 Jun 2010 22:16:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Regarding Format Debt</title>
		<link>http://www.backdrifter.com/2009/01/12/regarding-format-debt/</link>
		<comments>http://www.backdrifter.com/2009/01/12/regarding-format-debt/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 00:27:17 +0000</pubDate>
		<dc:creator>Jared Hanson</dc:creator>
				<category><![CDATA[Unknown]]></category>
		<category><![CDATA[atom]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[microformats]]></category>
		<category><![CDATA[mime]]></category>
		<category><![CDATA[rest]]></category>

		<guid isPermaLink="false">http://www.backdrifter.com/?p=125</guid>
		<description><![CDATA[An interesting (non-geeks, excuse yourself) discussion has arisen as the result of Bill de hÓra&#8217;s post Format Debt, what you can&#8217;t say.  At the heart of the argument is how to appropriately indicate layering given the inadequacy of Internet media types to specify that information.  The problem crops up often, especially in regard [...]]]></description>
			<content:encoded><![CDATA[<p>An interesting (non-geeks, excuse yourself) discussion has arisen as the result of <a href="http://dehora.net/">Bill de hÓra</a>&#8217;s post <a href="http://dehora.net/journal/2009/01/10/format-debt-what-you-cant-say/">Format Debt, what you can&#8217;t say</a>.  At the heart of the argument is how to appropriately indicate layering given the inadequacy of <a href="http://en.wikipedia.org/wiki/Internet_media_type">Internet media types</a> to specify that information.  The problem crops up often, especially in regard to <a href="http://en.wikipedia.org/wiki/HTML">HTML</a> with nested <a href="http://microformats.org/">microformats</a>.</p>
<p>For example, an HTML document is served up with a media type of <code>text/html</code>, but the actual information in the page is a person&#8217;s contact information marked up using <a href="http://microformats.org/wiki/hcard">hCard</a>.  An application interested in utilizing that contact information has no way of knowing whether or not the page contains that data without resorting to parsing it.</p>
<p><span id="more-125"></span></p>
<blockquote><p>
We say we want layered formats, because that&#8217;s what the combination of IETF IDs, W3C Recommendations and deployed browsers and servers allow us to say. It&#8217;s the Web version of of the <a href="http://www.paulgraham.com/avg.html">Blub paradox</a>.  What we want is layered data.  What we want is not just to qualify a media type, but to describe the ingredients in the entity whose &#8220;shell&#8221; is the media type.
</p></blockquote>
<p>I&#8217;d suggest that if you arrive at this point, it may indicate you&#8217;ve picked the wrong &#8220;shell.&#8221; Maybe I&#8217;m too dismissive, but I think there will always exist an impedance mismatch when attempting to define nested schemas for formats not suited to the purpose.  The fact that we&#8217;ve reached a certain level of maturity with regard to extensibility (a huge engineering boon) is an exacerbating factor.</p>
<p>Before I get criticized for this viewpoint, I want to note explicitly that I am a proponent of microformats.  I think they are incredible, and the enabling potential they offer to future browser extensions is well worth the effort in defining and developing them.</p>
<p>However, I believe this propensity towards nesting is ill-suited for scenarious involving structured data, often implying machine-to-machine communication.  Any inadequecies inherent in media types can be easily overcome: simply define more formats that don&#8217;t necessitate deeper nesting.  As a bonus, this fully complies with the <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST</a> architectural constraints.</p>
<p>In the address book example, HTML pages with microformats can continue to be delivered to people surfing via browsers.  However, applications that are interested in structured data can request the same information be returned, not as HTML, but as <a href="http://en.wikipedia.org/wiki/VCard">vCard</a>, a format designed specifically for the purpose of storing contact information, and delivered with a media type of <code>text/x-vcard</code>.</p>
<p>Nesting information in <a href="http://en.wikipedia.org/wiki/Atom_(standard)">Atom</a> (or <a href="http://en.wikipedia.org/wiki/RSS_(file_format)">RSS</a>), while not obviating the media type issue, does not pose nearly the same problems.  The reason is because Atom has a clear purpose as a container format, namely carrying a feed of items, such as news articles, that are generated over time.  In contrast to the generic document markup of HTML, there are already constraints in place that should serve as guides when deciding whether or not Atom is an appropriate container.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.backdrifter.com/2009/01/12/regarding-format-debt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>oEmbed FAIL! Represent RESTfully.</title>
		<link>http://www.backdrifter.com/2008/05/09/oembed-fail-represent-restfully/</link>
		<comments>http://www.backdrifter.com/2008/05/09/oembed-fail-represent-restfully/#comments</comments>
		<pubDate>Fri, 09 May 2008 22:12:14 +0000</pubDate>
		<dc:creator>Jared Hanson</dc:creator>
				<category><![CDATA[Unknown]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[oembed]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xrds]]></category>

		<guid isPermaLink="false">http://www.backdrifter.com/2008/05/09/oembed-fail-represent-restfully/</guid>
		<description><![CDATA[oEmbed is the latest standard to come out of the Web 2.0 developer crowd.  While I&#8217;m typically a huge advocate of standards, and think much of the prior work has been superb, oEmbed fails on almost every level.  So much so, in fact, that I&#8217;m writing this post to declare it worthless, and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://oembed.com/">oEmbed</a> is the latest standard to <a href="http://www.readwriteweb.com/archives/oembed_open_format.php">come out</a> of the Web 2.0 developer crowd.  While I&#8217;m typically a huge advocate of standards, and think much of the prior work has been superb, oEmbed fails on almost every level.  So much so, in fact, that I&#8217;m writing this post to declare it worthless, and suggest an alternative.</p>
<p>Upon first seeing the spec, I immediately <a href="http://twitter.com/jaredhanson/statuses/807531511">tweeted</a>:</p>
<blockquote><p>
oEmbed completely ignores REST principles. GET with a Content-Type to the original resource. Benefit: a single URL per resource. C&#8217;mon!
</p></blockquote>
<p>Allow me to further explain&#8230;</p>
<p><span id="more-95"></span></p>
<p>To begin with, let&#8217;s dive into the <a href="http://oembed.com/">specification</a>, and take note of the things that immediately raise red flags.</p>
<blockquote><p>
An oEmbed exchange occurs between a consumer and a provider. A consumer wishes to show an embedded representation of a third party resource on their own web site, such as a photo or an embedded video. A provider implements the oEmbed API to allow consumers to fetch that representation.
</p></blockquote>
<p>Hmm&#8230; that sounds suspiciously like an <a href="http://en.wikipedia.org/wiki/HTTP">HTTP</a> GET request.  Why the need to refer to this as &#8220;the oEmbed API&#8221;?!?  Something suspect must be about to go down.</p>
<blockquote><p>
Configuration for oEmbed is very simple. Providers must specify one or more URL scheme and API endpoint pairs. The URL scheme describes which URLs provided by the service may have an embedded representation. The API endpoint describes where the consumer may request representations for those URLs.
</p></blockquote>
<p>Wait&#8230; what?  This oEmbed thing requires two <a href="http://en.wikipedia.org/wiki/URL">URL</a>s to fetch different representations of the same resource?  Have we not learned even the most rudimentary <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST</a> principles in the past few years?  Here&#8217;s a quick lesson: a single resource can have multiple representations.  One URL, multiple data formats.  Once that is understood, the need for an oEmbed API endpoint drops away entirely.</p>
<p>Even so, let&#8217;s be pragmatic and use oEmbed, since some respectable providers have already implemented support for it. (Which begs further questions, but I&#8217;ll let that slide.)  To start, we need to get the address of the API endpoint.  That mechanism is not specified, so we&#8217;ll have to resort to hardcoding endpoints.  <a href="http://en.wikipedia.org/wiki/XRDS">XRDS</a> could be useful here, but that introduces further complications.  Besides, there is better way.</p>
<p><b>oEmbed with REST to the Rescue!</b></p>
<p>Since the URL to the original resource must be known, and an oEmbed representation is desired, the oEmbed API endpoint is completely unnecessary.  Just request the oEmbed representation from the resource directly.<br />
<code><br />
GET /photos/bees/2362225867/ HTTP/1.1<br />
Host: flickr.com<br />
Accept: application/oembed+xml<br />
</code></p>
<p>Flickr could then respond with our embed-ready resource.<br />
<code><br />
HTTP/1.x 200 OK<br />
Content-Type: application/oembed+xml<br />
&nbsp;<br />
&lt;oembed&gt;<br />
&lt;version&gt;1.0&lt;/version&gt;<br />
&lt;type&gt;photo&lt;/type&gt;<br />
&lt;title&gt;Bacon Lollys&lt;/title&gt;<br />
&lt;author_name&gt;bees&lt;/author_name&gt;<br />
&lt;author_url&gt;http://www.flickr.com/photos/bees/&lt;/author_url&gt;<br />
&lt;cache_age&gt;3600&lt;/cache_age&gt;<br />
&lt;provider_name&gt;Flickr&lt;/provider_name&gt;<br />
&lt;provider_url&gt;http://www.flickr.com/&lt;/provider_url&gt;<br />
&lt;width&gt;500&lt;/width&gt;<br />
&lt;height&gt;375&lt;/height&gt;<br />
&lt;url&gt;http://farm4.static.flickr.com/3040/2362225867_4a87ab8baf.jpg&lt;/url&gt;<br />
&lt;/oembed&gt;<br />
</code></p>
<p>See that! There is absolutely zero requirement for the oEmbed API.  All we need to do is define a couple data formats and the associated <a href="http://en.wikipedia.org/wiki/MIME_type">MIME types</a>.  While there is evidence of duplicative effort, the oEmbed formats look reasonable and have both <a href="http://en.wikipedia.org/wiki/XML">XML</a> and <a href="http://en.wikipedia.org/wiki/JSON">JSON</a> output.  I propose we define them as <code>application/oembed+xml</code> and <code>application/oembed+json</code>.</p>
<p>Error handling is equally trivial.  If support for RESTful oEmbed is not implemented, a standard HTTP <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7">406 Not Acceptable</a> status code would be returned to the client.  The client could then fail over to screen scraping or proprietary APIs as necessary.</p>
<p>I hope I&#8217;ve outlined my case against oEmbed effectively.  If anyone has any questions or concerns, drop a line in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.backdrifter.com/2008/05/09/oembed-fail-represent-restfully/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails 1.2 Released</title>
		<link>http://www.backdrifter.com/2007/01/19/ruby-on-rails-12-released/</link>
		<comments>http://www.backdrifter.com/2007/01/19/ruby-on-rails-12-released/#comments</comments>
		<pubDate>Sat, 20 Jan 2007 05:34:08 +0000</pubDate>
		<dc:creator>Jared Hanson</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.backdrifter.com/2007/01/19/ruby-on-rails-12-released/</guid>
		<description><![CDATA[Ruby on Rails 1.2 has been released!  This is the latest version of the popular framework for building web applications.  Coinciding with this release of Rails 1.2 is the release of Prototype 1.5.  Prototype is the JavaScript framework that powers the rich functionality of many web applications.
Ruby on Rails dramatically altered the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rubyonrails.org/">Ruby on Rails</a> 1.2 has been <a href="http://weblog.rubyonrails.org/2007/1/19/rails-1-2-rest-admiration-http-lovefest-and-utf-8-celebrations">released</a>!  This is the latest version of the popular framework for building web applications.  Coinciding with this release of Rails 1.2 is the <a href="http://weblog.rubyonrails.org/2007/1/19/prototype-1-5-now-with-a-manual">release</a> of <a href="http://www.prototypejs.org/">Prototype</a> 1.5.  Prototype is the JavaScript framework that powers the rich functionality of many web applications.</p>
<p>Ruby on Rails dramatically altered the way people build web applications.  With the 1.2 release, it continues to influence thought patterns by bringing <a href="http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm">REST</a> to the forefront.  REST provides a set of principles for the design of network-based software.  By presenting these patterns to a mainstream audience, Rails is having a profound impact on the future of software development.</p>
<p>The release also has numerous other improvements, including Unicode support, a new URL routing implementation, and better module loading.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.backdrifter.com/2007/01/19/ruby-on-rails-12-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
