Re: Context Link Header on PUT/POST?

> On Mar 5, 2015, at 2:34 PM, Robert Sanderson <azaroth42@gmail.com> wrote:
> 
> 
> Dear all,
> 
> The specification is clear about the use of a link header to provide a context for JSON to upgrade to JSON-LD when a document is being retrieved via HTTP GET:
>     http://www.w3.org/TR/json-ld/#interpreting-json-as-json-ld
> 
> Can, and if so should, this pattern also be available when accepting *requests* via PUT, POST or PATCH where the entity body's content-type is specified to be application/json?  In other words, should a well-behaved application also look for a link header on requests giving a context, rather than assuming it will be in the JSON itself?

Hi Rob,

The spec only concerns itself with retrieving JSON documents where a Link header might provide a context. Moreover, it's limited to application/json; if provided with application/ld+json it should be ignored.

[[[
Please note that JSON-LD documents served with the application/ld+json media type must have all context information, including references to external contexts, within the body of the document. Contexts linked via a http://www.w3.org/ns/json-ld#context HTTP Link Header must be ignored for such documents.
]]]

From Wikipedia [1], it seems that the Link header may just be valid for Response objects, not Request objects, but I confess that I can't really tell what Header fields (request or response) are defined for HTTP 2.0. Were it legal, then IMO supplying a Link to the context as part of a POST/PUT/PATCH would be reasonable, but why do it? The main intention of the Link header is to either provide a context for a document that can't otherwise be modified to include it inline, or when the client might not be able to handle anything other than application/json. Obviously, in the request case, both client and server must be JSON-LD aware, so placing it within the body makes the most sense (to me, anyway).

Gregg

[1] http://en.wikipedia.org/wiki/List_of_HTTP_header_fields

> My assumption is Yes, but it would be nice to hear if that is the group consensus :)
> 
> Many thanks,
> 
> Rob
> 
> 
> -- 
> Rob Sanderson
> Information Standards Advocate
> Digital Library Systems and Services
> Stanford, CA 94305

Received on Friday, 6 March 2015 01:13:35 UTC