You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -55,7 +56,7 @@ Hints are just that -- they are not a contract, and are to only be taken as advi
55
56
56
57
More fine-grained information might also be gathered by interacting with the resource (e.g., via a GET), or by another resource containing it (such as a widgets collection) or describing it (e.g., one linked to it with a "describedby" link relation).
57
58
58
-
There is not a single way to convey hints with a link; rather, it is expected that this will be done by individual link serialisations (see {{Section 3.4.1 of WEB-LINKING}}). However, {{link_header}} does recommend how to include link hints in the existing Link header field.
59
+
There is not a single way to convey hints with a link; rather, it is expected that this will be done by individual link serialisations (see {{Section 3.4.1 of WEB-LINKING}}).
59
60
60
61
61
62
## Notational Conventions
@@ -65,30 +66,9 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S
65
66
66
67
# HTTP Link Hints {#link_hints}
67
68
68
-
A HTTP link hint is a (key, value) tuple that describes the target resource of a Web link {{WEB-LINKING}}, or the link itself. The value's canonical form is a JSON {{JSON}} data structure specific to that hint.
69
+
A HTTP link hint is a (key, value) tuple that describes the target resource of a Web link {{WEB-LINKING}}, or describes the link itself. The value's canonical form is expressed in subset of the data types defined by HTTP Structured Fields {{STRUCTURED-FIELDS}}.
69
70
70
-
Typically, link hints are serialised in links as target attributes ({{Section 3.4.1 of WEB-LINKING}}).
71
-
72
-
In JSON-based formats, this can be achieved by simply serialising link hints as an object; for example:
73
-
74
-
75
-
~~~ json
76
-
{
77
-
"_links": {
78
-
"self": {
79
-
"href": "/orders/523",
80
-
"hints": {
81
-
"allow": ["GET", "POST"],
82
-
"accept-post": [
83
-
"application/example+json"
84
-
]
85
-
}
86
-
}
87
-
}
88
-
}
89
-
~~~
90
-
91
-
In other link formats, this requires a mapping from the canonical JSON data model into the constraints of that format. One such mapping is described in {{link_header}} for the Link HTTP header field.
71
+
Typically, link hints are serialised in links as target attributes ({{Section 3.4.1 of WEB-LINKING}}). In the Link HTTP Header, this can be done by serialising those attributes as strings. In other link formats, this requires a mapping from the canonical data model into the constraints of that format.
92
72
93
73
The information in a link hint SHOULD NOT be considered valid for longer than the freshness lifetime ({{Section 4.2 of HTTP-CACHING}}) of the representation that the link occurred within, and in some cases, it might be valid for a considerably shorter period.
94
74
@@ -102,89 +82,79 @@ Likewise, the information in a link hint is specific to the link it is attached
102
82
103
83
* Hint Name: allow
104
84
* Description: Hints the HTTP methods that can be used to interact with the target resource; equivalent to the Allow HTTP response header.
105
-
* Content Model: array (of strings)
85
+
* Content Model: Inner List of Strings
106
86
* Specification: \[this document]
107
87
108
-
Content MUST be an array of strings, containing HTTP methods ({{Section 9 of HTTP}}).
88
+
Content MUST be a Inner List of Strings, containing HTTP methods ({{Section 9 of HTTP}}).
109
89
110
90
## formats
111
91
112
92
* Hint Name: formats
113
93
* Description: Hints the representation type(s) that the target resource can produce and consume, using the GET and PUT (if allowed) methods respectively.
114
-
* Content Model: array (of strings)
94
+
* Content Model: Inner List of Strings
115
95
* Specification: \[this document]
116
96
117
-
Content MUST be an array of strings, containing media types ({{Section 8.3.1 of HTTP}}).
97
+
Content MUST be a Inner List of Strings, containing media types ({{Section 8.3.1 of HTTP}}).
118
98
119
99
## accept-post
120
100
121
101
* Hint Name: accept-post
122
102
* Description: Hints the POST request format(s) that the target resource can consume.
123
-
* Content Model: array (of strings)
103
+
* Content Model: Inner List of Strings
124
104
* Specification: \[this document]
125
105
126
-
Content MUST be an array of strings, with the same constraints as for "formats".
106
+
Content MUST be a Inner List of Strings, with the same constraints as for "formats".
127
107
128
-
When this hint is present, "POST" SHOULD be listed in the "allow" hint.
108
+
When this hint is present, "POST" SHOULD be listed in the "allow" hint when present.
129
109
130
110
## accept-patch
131
111
132
112
* Hint Name: accept-patch
133
113
* Description: Hints the PATCH {{!RFC5789}} request format(s) that the target resource can consume; equivalent to the Accept-Patch HTTP response header.
134
-
* Content Model: array (of strings)
114
+
* Content Model: Inner List of Strings
135
115
* Specification: \[this document]
136
116
137
-
Content MUST be an array of strings, containing media types ({{Section 8.3.1 of HTTP}}) that identify the acceptable patch formats.
117
+
Content MUST be a Inner List of Strings, containing media types ({{Section 8.3.1 of HTTP}}) that identify the acceptable patch formats.
138
118
139
-
When this hint is present, "PATCH" SHOULD be listed in the "allow" hint.
119
+
When this hint is present, "PATCH" SHOULD be listed in the "allow" hint when present.
140
120
141
121
## accept-ranges
142
122
143
123
* Hint Name: accept-ranges
144
124
* Description: Hints the range-specifier(s) available for the target resource; equivalent to the Accept-Ranges HTTP response header {{HTTP}}.
145
-
* Content Model: array (of strings)
125
+
* Content Model: Inner List of Strings
146
126
* Specification: \[this document]
147
127
148
-
Content MUST be an array of strings, containing HTTP ranges-specifiers ({{Section 14.1.1 of HTTP}}).
128
+
Content MUST be a Inner List of Strings, containing HTTP ranges-specifiers ({{Section 14.1.1 of HTTP}}).
149
129
150
130
## accept-prefer
151
131
152
132
* Hint Name: accept-prefer
153
133
* Description: Hints the preference(s) {{!RFC7240}} that the target resource understands (and might act upon) in requests.
154
-
* Content Model: array (of strings)
134
+
* Content Model: Inner List of Strings
155
135
* Specification: \[this document]
156
136
157
-
Content MUST be an array of strings, contain preferences ({{Section 2 of RFC7240}}). Note that, by its nature, a preference can be ignored by the server.
137
+
Content MUST be a Inner List of Strings, containing preferences ({{Section 2 of RFC7240}}). Note that, by its nature, a preference can be ignored by the server.
158
138
159
139
## precondition-req
160
140
161
141
* Hint Name: precondition-req
162
142
* Description: Hints that the target resource requires state-changing requests (e.g., PUT, PATCH) to include a precondition, as per {{Section 13.1 of HTTP}}, to avoid conflicts due to concurrent updates.
163
-
* Content Model: array (of strings)
143
+
* Content Model: Inner List of Strings
164
144
* Specification: \[this document]
165
145
166
-
Content MUST be an array of strings, with possible values "etag" and "last-modified" indicating type of precondition expected.
146
+
Content MUST be a Inner List of Strings, with possible values "etag" and "last-modified" indicating type of precondition expected.
167
147
168
148
See also the 428 Precondition Required status code ({{!RFC6585}}).
169
149
170
150
## auth-schemes
171
151
172
152
* Hint Name: auth-schemes
173
153
* Description: Hints that the target resource requires authentication using the HTTP Authentication framework {{Section 11 of HTTP}}.
174
-
* Content Model: array (of strings)
154
+
* Content Model: Inner List of Strings
175
155
* Specification: \[this document]
176
156
177
-
Content MUST be an array of strings, each corresponding to a HTTP authentication scheme ({{Section 11.1 of HTTP}}), and optionally a "realms" member containing an array of zero to many strings that identify protection spaces that the resource is a member of.
178
-
179
-
For example:
180
-
181
-
~~~ json
182
-
{
183
-
"auth-schemes": [
184
-
"Basic", "Digest"
185
-
]
186
-
}
187
-
~~~
157
+
Content MUST be a Inner List of Strings, each corresponding to a HTTP authentication scheme ({{Section 11.1 of HTTP}}), and optionally a "realms" member containing an array of zero to many strings that identify protection spaces that the resource is a member of.
188
158
189
159
## auth-realms
190
160
@@ -195,27 +165,17 @@ For example:
195
165
196
166
Content MUST be an array of strings, each indicating a protection space that the resource is a member of.
197
167
198
-
For example:
199
-
200
-
~~~ json
201
-
{
202
-
"auth-realms": [
203
-
"private"
204
-
]
205
-
}
206
-
~~~
207
-
208
168
## status
209
169
210
170
* Hint Name: status
211
171
* Description: Hints the status of the target resource.
212
-
* Content Model: string
172
+
* Content Model: Token
213
173
* Specification: \[this document]
214
174
215
-
Content MUST be a string; possible values are:
175
+
Content MUST be a Token; possible values are:
216
176
217
-
* "deprecated" - indicates that use of the resource is not recommended, but it is still available.
218
-
* "gone" - indicates that the resource is no longer available; i.e., it will return a 410 (Gone) HTTP status code if accessed.
177
+
* deprecated - indicates that use of the resource is not recommended, but it is still available.
178
+
* gone - indicates that the resource is no longer available; i.e., it will return a 410 (Gone) HTTP status code if accessed.
219
179
220
180
221
181
@@ -234,65 +194,25 @@ Link hints are generic; that is, they are potentially applicable to any HTTP res
234
194
235
195
Hint names MUST be composed of the lowercase letters (a-z), digits (0-9), underscores ("_") and hyphens ("-"), and MUST begin with a lowercase letter.
236
196
237
-
Hint content MUST be described in terms of JSON values ({{Section 3 of JSON}}).
197
+
Hint content MUST be described using valid combinations of the following types defined by HTTP Structured Fields ({{STRUCTURED-FIELDS}}):
198
+
199
+
* Inner List ({{Section 3.1.2 of STRUCTURED-FIELDS}})
200
+
* Item ({{Section 3.3 of STRUCTURED-FIELDS}})
238
201
239
202
Hint semantics SHOULD be described in terms of the framework defined in {{WEB-LINKING}}.
240
203
241
204
New hints are registered using the Expert Review process described in {{?RFC8126}} to enforce the criteria above. Requests for registration of new resource hints are to use the following template:
242
205
243
206
* Hint Name: \[hint name]
244
207
* Description: \[a short description of the hint's semantics]
245
-
* Content Model: \[valid JSON value types; see RFC627 Section 2.1]
* Specification: \[reference to specification document]
247
210
248
211
Initial registrations are enumerated in {{hints}}. The "rel", "rev", "hreflang", "media", "title", and "type" hint names are reserved, so as to avoid potential clashes with link serialisations.
249
212
250
213
251
214
--- back
252
215
253
-
# Representing Link Hints in Link Headers {#link_header}
254
-
255
-
A link hint can be represented in a Link header ({{Section 3 of WEB-LINKING}}) as a link-extension.
256
-
257
-
When doing so, the JSON of the hint's content SHOULD be normalised to reduce extraneous spaces (%x20), and MUST NOT contain horizontal tabs (%x09), line feeds (%x0A) or carriage returns (%x0D). When they are part of a string value, these characters MUST be escaped as described in {{Section 7 of JSON}}; otherwise, they MUST be discarded.
258
-
259
-
Furthermore, if the content is an array or an object, the surrounding delimiters MUST be removed before serialisation. In other words, the outermost object or array is represented without the braces ("{}") or brackets ("[]") respectively, but this does not apply to inner objects or arrays.
260
-
261
-
For example, the two JSON values below are those of the fictitious "example" and "example1" hints, respectively:
262
-
263
-
~~~
264
-
"The Example Value"
265
-
1.2
266
-
~~~
267
-
268
-
In a Link header, they would be serialised as:
269
-
270
-
~~~ http-message
271
-
Link: </>; rel="sample"; example="The Example Value";
0 commit comments