@@ -37,7 +37,7 @@ Clients and servers **MUST** send all JSON:API data using this media type in the
37
37
38
38
Further, the JSON: API media type ** MUST** always be specified with either no
39
39
media type parameters or with only the ` profile ` parameter. This applies to both
40
- the ` Content-Type ` and ` Accept ` headers.
40
+ the ` Content-Type ` and ` Accept ` headers whenever they are present .
41
41
42
42
> Note: A media type parameter is an extra piece of information that can
43
43
accompany a media type. For example, in the header
@@ -48,9 +48,6 @@ The `profile` parameter is used to support [profiles].
48
48
49
49
### <a href =" #content-negotiation-clients " id =" content-negotiation-clients " class =" headerlink " ></a > Client Responsibilities
50
50
51
- Clients that include the JSON: API media type in their ` Accept ` header ** MUST**
52
- specify the media type there at least once without any media type parameters.
53
-
54
51
When processing a JSON: API response document, clients ** MUST** ignore any
55
52
parameters other than ` profile ` in the server's ` Content-Type ` header.
56
53
@@ -61,8 +58,14 @@ a request specifies the header `Content-Type: application/vnd.api+json`
61
58
with any media type parameters other than ` profile ` .
62
59
63
60
Servers ** MUST** respond with a ` 406 Not Acceptable ` status code if a
64
- request's ` Accept ` header contains the JSON: API media type and all instances
65
- of that media type are modified with media type parameters.
61
+ request's ` Accept ` header contains the JSON: API media type and the server is
62
+ unable to respond with an acceptable representation. The response ** MUST** contain
63
+ an [ error object] which lists the unsupported profile or profiles as
64
+ its ` source ` and which has the following URI as (one of) its ` type ` s:
65
+
66
+ ```
67
+ https://jsonapi.org/errors/profile-not-supported
68
+ ```
66
69
67
70
> Note: These content negotiation requirements exist to allow future versions
68
71
of this specification to add other media type parameters for extension
@@ -1908,26 +1911,32 @@ parameter **MUST** equal a space-separated (U+0020 SPACE, " ") list of profile U
1908
1911
> (U+0022 QUOTATION MARK, "\" ") if it contains more than one URI.
1909
1912
1910
1913
A client ** MAY** use the ` profile ` media type parameter in conjunction with the
1911
- JSON: API media type in an ` Accept ` header to _ request_ , but not _ require_ , that
1912
- the server apply one or more profiles to the response document. When such a
1913
- request is received, a server ** SHOULD** attempt to apply the requested profiles
1914
- to its response.
1914
+ JSON: API media type in an ` Accept ` header to request that the server apply one
1915
+ or more profiles to the response document. When such a request is received, a
1916
+ server ** SHOULD** attempt to apply the requested profiles to its response.
1915
1917
1916
1918
For example, in the following request, the client asks that the server apply the
1917
- ` http://example.com/last-modified ` profile if it is able to.
1919
+ ` http://example.com/last-modified ` profile if it is able to. If the server is
1920
+ unable to apply the profile, it may send a response without the profile applied
1921
+ because the client also specified the JSON: API media type without the ` profile `
1922
+ media type parameter.
1918
1923
1919
1924
``` http
1920
1925
Accept: application/vnd.api+json;profile="http://example.com/last-modified", application/vnd.api+json
1921
1926
```
1922
1927
1923
- > Note: The second instance of the JSON: API media type in the example above is
1924
- required under the [ client's content negotiation responsibilities] ( #content-negotiation-clients ) .
1925
- It is used to support old servers that don't understand the profile parameter.
1928
+ In the following request, the client asks the server to process its request
1929
+ using the ` http://example.com/boolean-filters ` profile. In this case, the client
1930
+ does not specify the bare JSON: API media type because it would not like a
1931
+ response unless the request was processed using the specified profile.
1932
+
1933
+ ``` http
1934
+ Accept: application/vnd.api+json;profile="http://example.com/boolean-filters"
1935
+ ```
1926
1936
1927
- Servers ** MAY** add profiles to a JSON: API document even if the client has not
1928
- requested them. The recipient of a document ** MUST** ignore any profiles in that
1929
- document that it does not understand. The only exception to this is profiles
1930
- whose support is required using the ` profile ` query parameter, as described later.
1937
+ Servers ** MAY** process messages using one or more profiles even if the client has
1938
+ not requested them. The recipient of a document to which an unknown profile
1939
+ has been applied ** MUST** ignore any document members that it does not understand.
1931
1940
1932
1941
#### <a href =" #profiles-sending " id =" profiles-sending " class =" headerlink " ></a > Sending Profiled Documents
1933
1942
@@ -2325,6 +2334,8 @@ An error object **MAY** have the following members:
2325
2334
exists; if it doesn't, the client ** SHOULD** simply ignore the pointer.
2326
2335
* ` parameter ` : a string indicating which URI query parameter caused
2327
2336
the error.
2337
+ * ` profiles ` : an array of the requested profile URIs that the server was not
2338
+ able to support.
2328
2339
* ` meta ` : a [ meta object] [ meta ] containing non-standard meta-information about the
2329
2340
error.
2330
2341
0 commit comments