Re: Question about the On Linking Alternative Representations TAG Finding

On Thu, 2008-07-31 at 16:16 -0400, Alan Ruttenberg wrote:
> 
> On Jul 31, 2008, at 1:23 PM, Booth, David (HP Software - Boston) wrote:
> >>
> > I think serving the JSON is the best option.  Serving HTML from / 
> > resource.json would defeat the purpose of having a JSON-specific  
> > URI.   It is quite likely that the user pasted the JSON URI into a  
> > browser to test it, and *wants* to see the JSON that is returned.   
> > Everyone knows how to paste a URI into a browser; few know how to  
> > configure their browsers to specify their desired MIME types.
> 
> I don't see how the best option is to ignore the accept header. If  
> the accept header says to accept only html then you shouldn't respond  
> with a different mime type as if that was an appropriate response.  
> The 406 or 30x responses make more sense.
> 
> It's like saying, in a negotiation, that it's a fine thing to ignore  
> other negotiator and do what you want. Its not much of a negotiation  
> in that case.

Well, yes, but keep in mind the premise:

 /resource.json (a JSON specific URI)

i.e. the provider/server doesn't offer to negotiate types
for /resource.json .

Meanwhile, the HTTP spec seems to prefer 406 in this case:

"If an Accept header field is present, and if the server cannot send a
response which is acceptable according to the combined Accept field
value, then the server SHOULD send a 406 (not acceptable) response."
  -- http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1

I thought there was some language a la "regardless of what
clients say in the Accept: header, they need to be prepared
for other media types to come back" but I don't see it in there.

Maybe a 406 response could be helpful at least to humans if it said:

  Did you mean <a href="/resource.html">the HTML version?</a>.

-- 
Dan Connolly, W3C http://www.w3.org/People/Connolly/
gpg D3C2 887B 0F92 6005 C541  0875 0F91 96DE 6E52 C29E

Received on Thursday, 31 July 2008 20:30:37 UTC