On Wed, Jun 30, 2010 at 7:39 AM, Don Werve <d...@madwombat.com> wrote:
> 2010/6/27 Jason Chaffee <jchaf...@ebates.com> > > > The solr docs say it is RESTful, yet it seems that it doesn't use http > > headers in a RESTful way. For example, it doesn't seem to use the > Accept: > > request header to determine the media-type to be returned. Instead, it > > requires a query parameter to be used in the URL. Also, it doesn't seem > to > > use return 304 Not Modified if the request header "if-modified-since" is > > used. > > > > The summary: > > Solr is restful, and does a very good job of it. > > The long version: > > There is no official 'REST' standard that dictates the behavior of the > implementation; rather, REST is a set of guidelines on building APIs that > are both discoverable and easily usable without having to resort to > third-party libraries. > > Generally speaking, an application is RESTful if it provides an API that > accepts arguments passed as HTTP form variables, returns results in an open > format (XML, JSON, YAML, etc.), and respects certain semantics relating to > HTTP verbs; e.g., GET/HEAD return the resource without modification, > DELETEs > are destructive, POST creates a resource, PUT alters it. > > Actually it is not a constraint to use all of four *GET*, *PUT*, *POST*, * DELETE.* To define RESTful, using Get and Post requests are enough as Roy Fielding offered. http://roy.gbiv.com/untangled/2009/it-is-okay-to-use-post > Solr meets all of these requirements. > > The nature of the result format, and how to change it, is entirely up to > the > implementer. A common convention is to use a filename extension (.json, > .xml) appended to the URL. It's less common to specify the request format > as part of the query parameters (like Solr does), but not unheard of. And, > to be honest, this is actually the first time I've heard of using the > 'Accept' header to change the result format, as it makes it a lot harder to > use a web browser, or command-line tools like curl or wget, to debug your > API. >