Content negotiation with query string arguments
The second method of content negotiation uses two query string arguments (QSAs) on the requested URL:
_profile
, which is the equivalent of HTTP headerAccept-Profile
._mediatype
, which is the equivalent of HTTP headerAccept
.
These arguments work exactly like their equivalent HTTP headers, with one exception: the special value alt
for the _profile
QSA returns the available content for the requested MDO in application/json
format.
Profile tokens
Profile tokens are aliasses for full profile URLs. The resolver API chooses to use the canonical namespace prefix shorthand as profile tokens whenever possible. For example, this would make the token for http://schema.org/
be schema
.
The existence of such tokens is indicated by the resolver in the response body served for a _profile=alt
request and with a Link header <http://www.w3.org/ns/dx/prof/Profile>; rel="type"; token="schema"; anchor=<http://schema.org/>
that is available on every response.
Negotiation method order of precedence
When handling a request, the Resolver API fist looks for the _profile
QSA. If provided, any HTTP headers related to content negotiation are ignored.
Link
HTTP headers
Every repsonse from the Resolver API includes a Link
HTTP header whose value describes the following in a comma separated list:
<http://www.w3.org/ns/dx/prof/Profile>; rel="type"; token="edm"; anchor=<http://www.europeana.eu/schemas/edm/>
Describes that tokenedm
can be used as an alias for profile URLhttp://www.europeana.eu/schemas/edm/
.https://data.rijksmuseum.nl/20024929?_profile=schema>; type="application/n-tripes"; format="<http://schema.org/>"; rel="canonical"
Describes that Schema.org, serialized as N-Triples is the canonical representation of the requested metadata.<https://data.rijksmuseum.nl/20024929?_profile=la>; type="application/n-triples"; format="<https://linked.art/ns/terms/>"; rel="alternate"
Describes that an alternative representation using the Linked Art model, serialized as N-Triples is available.
Additionally, when a response returns content for an MDO id, a separate link header describing the profile the response body conforms to is added, in the following form:
# Indicates that the response conforms to the Linked Art model
Link: <https://linked.art/ns/terms/>; rel="profile"
Dereferencing from a browser
The Resolver API treats requests from web browser clients differently from requests from any other client in the following two ways:
- When dereferencing an MDO id without explicit content negotiation, the Resolver API tries to find the canonical homepage of the object described by the metadata. For the Nightwatch that would be https://www.rijksmuseum.nl/nl/collectie/SK-C-5.
- For content served by the Resolver API, browsers gets served a version with some additional markup and styling, with a
Content-Type
header oftext/html; charset=UTF-8
. This allows us to enhance the user experience by adding syntax highlighting, line numbers and clickable links.