jackie1929 / linked-data-api

Automatically exported from code.google.com/p/linked-data-api
0 stars 0 forks source link

Don't use HTTP POST where GET is appropriate #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Looking at http://reference.data.gov.uk/doc/department/dft, when the Run Query 
button is clicked a POST is used to submit the query. However the operation is 
just a lookup. 

To quote his Royness:
"It isn’t RESTful to use POST for information retrieval when that information 
corresponds to a potential resource, because that usage prevents safe 
reusability and the network-effect of having a URI."
http://roy.gbiv.com/untangled/2009/it-is-okay-to-use-post

The SPROT doc does allow for a POST, but :
"The queryHttpGet binding should be used except in cases where the URL-encoded 
query exceeds practical limits, in which case the queryHttpPost binding should 
be used."
http://www.w3.org/TR/rdf-sparql-protocol/

I've not personally encountered a situation where any SPARQL 1.0 query exceeds 
practical limits, and even if it did, surely the solution is for the server to 
be fixed, not for the client to use architecturally broken workarounds.

Copy & paste of the query for the DfT page into the endpoint at 
http://services.data.gov.uk/reference/sparql (note the link provided on the DfT 
page is broken) seems to work fine with a GET.

Original issue reported on code.google.com by danny.ay...@gmail.com on 3 Feb 2011 at 8:06