internetarchive/openlibrary — Issue #130: HTTP behavior of Open Library
Author: bencomp
Created: 2012-01-17 14:37:52+00:00
State: open

# Current behavior
Currently the OL web server returns different things when requesting the same URI/L but using different content type in the "Accept" header:
## Requesting HTML
### Request
GET /works/OL652562W HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
### Response
HTTP/1.1 301 Moved Permanently
Location: http://openlibrary.org/works/OL652562W/Amazing_stories_of_the_Bible

## Requesting RDF
### Request
GET /works/OL652562W HTTP/1.1
Accept: application/rdf+xml
### Reponse
HTTP/1.1 200 OK
Content-Type: application/rdf+xml

### Note
If you try to do this in this order using Firefox and the Modify Headers plugin, the second request will be changed to:
GET /works/OL652562W/Amazing_stories_of_the_Bible HTTP/1.1
Accept: application/rdf+xml

HTTP/1.1 404 Not Found
Content-Type: text/html
... because of the Moved Permanently.

# Proposed behavior
I'd like to propose a Cool URI behavior that redirects to the representation of the request, based on the content type the user requests. The "base" URI (http://openlibrary.org/works/OL652562W - without trailing "/") can then really be used to identify a Work, Edition or Author, and the HTML and RDF (and JSON etc.) representations have their own URIs.

## Requesting HTML
### Request
GET /works/OL652562W HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
### Response
HTTP/1.1 303 See Other
Location: http://openlibrary.org/works/OL652562W/Amazing_stories_of_the_Bible

## Requesting RDF
### Request
GET /works/OL652562W HTTP/1.1
Accept: application/rdf+xml
### Reponse
HTTP/1.1 303 See Other
Location: http://openlibrary.org/works/OL652562W.rdf

# Discussion / references
In January 2012 I sent email about this to the Tech list: http://www.mail-archive.com/ol-tech@archive.org/msg00513.html
In July 2010, the same issue was discussed shortly on the list: http://www.mail-archive.com/ol-tech@archive.org/msg00198.html.

The Cool URIs document is http://www.w3.org/TR/cooluris/ ; the section about redirects to different documents using HTTP 303 is http://www.w3.org/TR/cooluris/#r303uri.

Redirecting makes the difference between Thing and documents about that Thing more clear. Current HTTP behavior, 200 and 301 for the same resource, is also not what I expect.
Before addressing this issue, I believe it must be decided to either have or not have a trailing "/" for URIs that identify Works, Editions or Authors, because a URI with "/" is different from one without.