lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jason Chaffee" <>
Subject RE: REST calls
Date Wed, 30 Jun 2010 23:47:37 GMT
Using Accept headers is a pretty standard practice and so are conditional GETs.

Quite easy to test with curl:

 curl  -X GET -H	 "Accept:application/xml"

curl  -X GET -H	 "Accept:application/json"


-----Original Message-----
From: Don Werve [] 
Sent: Tuesday, June 29, 2010 9:40 PM
Subject: Re: REST calls

2010/6/27 Jason Chaffee <>

> 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.

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

View raw message