{"id":37,"date":"2007-12-17T00:12:21","date_gmt":"2007-12-17T07:12:21","guid":{"rendered":"http:\/\/codefork.com\/blog\/index.php\/2007\/12\/17\/http-xml-do-not-a-restful-interface-make\/"},"modified":"2007-12-17T10:28:07","modified_gmt":"2007-12-17T17:28:07","slug":"http-xml-do-not-a-restful-interface-make","status":"publish","type":"post","link":"https:\/\/codefork.com\/blog\/index.php\/2007\/12\/17\/http-xml-do-not-a-restful-interface-make\/","title":{"rendered":"HTTP + XML do not a RESTful interface make"},"content":{"rendered":"<p>I&#8217;ve been stumbling across criticisms of the un-RESTful design of Amazon&#8217;s new SimpleDB service. Worth reading in particular is a piece by someone named Subbu Allamaraju, who seems both smart and accomplished. He did a quick rewrite of the API in his post, <a href=\"http:\/\/www.subbu.org\/weblogs\/main\/2007\/12\/a_restful_versi.html\">A RESTful version of Amazon&#8217;s SimpleDB<\/a>. It&#8217;s a great example of how clean URLs can be when a bit of thought is put into them.<\/p>\n<p>And people should also read it to clear up a popular misunderstanding about REST. I&#8217;ve already given it away in my title: HTTP + XML do not a RESTful interface make. <\/p>\n<p>As <a href=\"http:\/\/www.ics.uci.edu\/~fielding\/pubs\/dissertation\/rest_arch_style.htm\">Roy Fielding&#8217;s dissertation chapter<\/a> lays it out, a REST architecture should follow the abstraction of &#8220;resources&#8221; from the &#8220;connectors&#8221; that perform operations on them. The HTTP protocol happens to be able to do this nicely: URLs refer to resources and the GET\/POST\/PUT\/DELETE methods manipulate them. However, this isn&#8217;t inherent or automatic: <em>you have to use its vocabulary properly<\/em>. SimpleDB is a perfect example: it violates the principle that resource identification and operations should be separate. The API embeds operations in URLs.<\/p>\n<p>So yes, it uses HTTP and XML. But no, those things alone don&#8217;t make it truly RESTful.<\/p>\n<p>REST is certainly a huge step forward in enforcing cleaner abstractions, though in Amazon&#8217;s defense, it&#8217;s obvious why they choose to design their API the way they did. The URLs for SimpleDB have the same structure as those in ECS; consistency was probably the goal. So yes, it&#8217;s a conservative move that forward-thinking coders are turning their noses up at, but it&#8217;s also one for which existing developers will probably be grateful. Rant all you want about the evils of non-idempotent GET requests&#8230; for Amazon&#8217;s customers, the old API style feels familiar, and means one less new thing to get used to, or to learn.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been stumbling across criticisms of the un-RESTful design of Amazon&#8217;s new SimpleDB service. Worth reading in particular is a piece by someone named Subbu Allamaraju, who seems both smart and accomplished. He did a quick rewrite of the API in his post, A RESTful version of Amazon&#8217;s SimpleDB. It&#8217;s a great example of how &hellip; <a href=\"https:\/\/codefork.com\/blog\/index.php\/2007\/12\/17\/http-xml-do-not-a-restful-interface-make\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;HTTP + XML do not a RESTful interface make&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-37","post","type-post","status-publish","format-standard","hentry","category-software"],"_links":{"self":[{"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/37","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=37"}],"version-history":[{"count":0,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/37\/revisions"}],"wp:attachment":[{"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codefork.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}