Re: can GET do for QUERY? extending Partial Content

> On 29 Apr 2015, at 07:04, Willy Tarreau <w@1wt.eu> wrote:
> 
> On Tue, Apr 28, 2015 at 11:59:18PM +0200, henry.story@bblfish.net wrote:
>> I tried it and it works on my server FWIW
>> 
>> -----------
>> $ telnet bblfish.net 80
>> Trying 208.64.60.175...
>> Connected to bblfish.net.
>> Escape character is '^]'.
>> GET / HTTP/1.1
>> Host: bblfish.net
>> Content-Type: text/query
>> Accept: text/csv
>> Content-Length: 42
>> 
>> select surname, givenname, email limit 10
> 
> Why not use POST then ? Passing a body in GET could confuse caches and
> result in wrong data being retrieved. There are reasons why POST is a
> different method.

Because POST is about creating a new resource or appending to one. Here
we are doing neither: we are just asking for a Partial Content of the 
resource requested, in the way RFC 7233 specifies it. We just need a
range request field for query result pages.

This is much better and RESTful for a number of reasons:

• these partial representations of the resource can be cached
• these cached representations can be used by query language aware 
  caches to reconstruct the full representation in some circumstances 
  ( just as with paging )
• it avoids URL explosion for partial representations of the same 
  resource, which have no relation to the original resource that 
  you get with POST.  
• This means DELETE, PUT, PATCH on the original resource invalidate
  the caches, which does not happen in the URL explosion case generated 
  by POST
•  With query urls you have a huge number of URLs referring to resources 
 with exactly the same access control rules as the non query resource. 
 This means much more complex access control rules, more work tracking 
 of rights managements, privacy settings, etc...
• Adding the query in the GET body, allows for semantically well defined 
query languages to be used, that could become globally available across the
web. 

For the type of queries I am interested in that provide partial 
representations of the original resource, GET fits the bill. There
is precedent for partial representations too. Essentially we are suggesting
extending the partial representation concept to allow us to specify the
representation using more complex languages than those provided by byte 
ordering.

I hope that helps show that this is not an abuse of GET, it just extends
existing usage.

Henry

> 
> Willy
> 

Social Web Architect
http://bblfish.net/

Received on Wednesday, 29 April 2015 08:13:33 UTC