@@ -36,10 +36,12 @@ Clients and servers **MUST** send all JSON:API data using this media type in the
36
36
` Content-Type ` header.
37
37
38
38
Further, the JSON: API media type ** MUST** always be specified with either no
39
- media type parameters or with only the ` profile ` parameter. This applies to both
40
- the ` Content-Type ` and ` Accept ` headers whenever they are present.
39
+ media type parameters, the ` ext ` parameter, the ` profile ` parameter or both the
40
+ ` ext ` and ` profile ` parameters. This applies to both the ` Content-Type ` and
41
+ ` Accept ` headers.
41
42
42
- The ` profile ` parameter is used to support [ profiles] .
43
+ The ` ext ` parameter is used to support [ extensions] and the ` profile ` parameter
44
+ is used to support [ profiles] .
43
45
44
46
> Note: A media type parameter is an extra piece of information that can
45
47
accompany a media type. For example, in the header
@@ -53,17 +55,24 @@ negotiation and versioning.
53
55
### <a href =" #content-negotiation-clients " id =" content-negotiation-clients " class =" headerlink " ></a > Client Responsibilities
54
56
55
57
When processing a JSON: API response document, clients ** MUST** ignore any
56
- parameters other than ` profile ` in the server's ` Content-Type ` header.
58
+ parameters other than ` ext ` and ` profile ` parameters in the server's
59
+ ` Content-Type ` header.
57
60
58
61
### <a href =" #content-negotiation-servers " id =" content-negotiation-servers " class =" headerlink " ></a > Server Responsibilities
59
62
60
- Servers ** MUST** respond with a ` 415 Unsupported Media Type ` status code if
61
- a request specifies the header ` Content-Type: application/vnd.api+json ` with
62
- any media type parameters other than ` profile ` .
63
+ If a request specifies the ` Content-Type ` header with the JSON: API media type,
64
+ servers ** MUST** respond with a ` 415 Unsupported Media Type ` status code if that
65
+ media type contains any media type parameters other than ` ext ` or ` profile ` .
66
+
67
+ If a request's ` Accept ` header contains an instance of the JSON: API media type,
68
+ servers ** MUST** respond with a ` 406 Not Acceptable ` status code if all
69
+ instances of that media type are modified with a media type parameter other
70
+ than ` ext ` or ` profile ` .
63
71
64
- Servers ** MUST** respond with a ` 406 Not Acceptable ` status code if a request's
65
- ` Accept ` header contains the JSON: API media type and all instances of that
66
- media type are modified with a media type parameter other than ` profile ` .
72
+ If a request's ` Accept ` header contains an instance of the JSON: API media type,
73
+ servers ** MUST** respond with a ` 406 Not Acceptable ` status code if every
74
+ instance of that media type is modified by the ` ext ` parameter and each
75
+ contains at least one unsupported extension URI.
67
76
68
77
## <a href =" #document-structure " id =" document-structure " class =" headerlink " ></a > Document Structure
69
78
@@ -1900,6 +1909,43 @@ parameter from this specification, it **MUST** return `400 Bad Request`.
1900
1909
> \[ a-z\] , JSON: API is reserving the ability to standardize additional query
1901
1910
> parameters later without conflicting with existing implementations.
1902
1911
1912
+ ## <a href =" #extensions " id =" extensions " class =" headerlink " ></a > Extensions
1913
+
1914
+ JSON: API supports the use of "extensions" as a way to indicate additional
1915
+ semantics that extend the basic semantics described in this specification.
1916
+
1917
+ An extension is a separate specification defining these extended semantics.
1918
+
1919
+ An exenstion ** MAY** impose additional processing rules or further restrictions
1920
+ and it ** MAY** define new object members as described below.
1921
+
1922
+ An extension ** MUST NOT** lessen or remove any processing rules, restrictions or
1923
+ object member requirements defined in this specification or other extensions.
1924
+
1925
+ ### <a href =" #extension-members " id =" extension-members " class =" headerlink " ></a > Extending Document Structure
1926
+
1927
+ An extension ** MAY** define new members within the document structure defined by
1928
+ this specification. The name of every new member introduced by an extension
1929
+ ** MUST** be prefixed with an extension namespace followed by a colon (` : ` ). The
1930
+ namespace ** MUST** be identical for every member introduced by a particular
1931
+ extension.
1932
+
1933
+ Namespaces guarantee that extensions will never conflict with the current or
1934
+ future versions of this specification.
1935
+
1936
+ In the following example, an extension requiring that each request document
1937
+ contains a unique request ID has been applied. It uses the namespace ` request `
1938
+ and adds a top-level object member named ` request:id ` :
1939
+
1940
+ ```
1941
+ {
1942
+ "request:id": "some-long-uuid",
1943
+ "data": {
1944
+ "type": "comments",
1945
+ }
1946
+ }
1947
+ ```
1948
+
1903
1949
## <a href =" #profiles " id =" profiles " class =" headerlink " ></a > Profiles
1904
1950
1905
1951
JSON: API supports the use of "profiles" as a way to indicate additional
@@ -2386,6 +2432,7 @@ request as equivalent to one in which the square brackets were percent-encoded.
2386
2432
[ link object ] : #document-links-link-object
2387
2433
[ link relation type ] : #document-links-link-relation-type
2388
2434
[ link parameters ] : #document-links-link-parameters
2435
+ [ extensions ] : #extensions
2389
2436
[ profiles ] : #profiles
2390
2437
[ timestamps profile ] : #profiles-timestamp-profile
2391
2438
[ profile keywords ] : #profile-keywords
0 commit comments