[protocol] [SPARQL-http] HTTP status codes

In the process of implementing "SPARQL Update over HTTP" and "SPARQL 
http-rdf-update" I found I was having to make decisions about the status 
codes returned.

== http-rdf-update

http-rdf-update should discuss the status code possibilities.

This document defines the naming scheme and the POST action, and 
describes the correct meaning of the REST verbs as applied to a 
collection of graphs.

It would be helpful to mention the correct HTTP status codes that each 
operation can return, and in what circumstances.  We aren't defining 
this, it is, like the operations informational but we can suggest the 
basic set to use and we effectively end up doing that in the tests anyway.

Because it is necessary for the tests, it is better to go in the doc for 
LC so there is no argument that a change is being made by the tests 
taking one particular view.

Others status codes are possible (e.g. 403 Forbidden, and WebDav added 
some), but the core ones are, I think [1]:

HEAD    "204 No Content", "404 Not Found"
GET     "200 OK", 404
PUT 204 or "201 Created"
DELETE  204
POST    204, 201

200 is possible for 204 if a message is returned.

This also has a small interaction with SPARQL Update.  PUT or POST 
indicate whether the resource already existed before the operation and 
return 200 or 201 based on that fact.   Some graph stores don't track 
the existence of empty graphs, some do. The same variability will show 
up in http-rdf-update for PUT status and for a subsequent GET or HEAD.

Is PUT of the empty graph to a named graph a DELETE?

== SPARQL Update / protocol

The status code for success should be 200 or 204 (or "202 Accepted").

200 is appropriate for a "application/x-www-form-urlencoded"
204 is appropriate for a "application/sparql-update"

 Andy

[1]
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

Received on Sunday, 10 October 2010 19:17:51 UTC