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
Copy file name to clipboardExpand all lines: draft-ietf-httpapi-link-hint.md
+32-26Lines changed: 32 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,12 @@ author:
29
29
uri: https://www.mnot.net/
30
30
31
31
normative:
32
+
HTTP: RFC9110
33
+
HTTP-CACHING: RFC9111
34
+
WEB-LINKING: RFC8288
35
+
JSON: RFC8259
36
+
URI: RFC3986
37
+
32
38
33
39
--- abstract
34
40
@@ -39,21 +45,21 @@ This memo specifies "HTTP Link Hints", a mechanism for annotating Web links to H
39
45
40
46
# Introduction
41
47
42
-
HTTP {{!RFC7230}} clients can discover a variety of information about a resource by interacting with it. For example, the methods supported can be learned through the Allow response header field, and the need for authentication is conveyed with a 401 Authentication Required status code.
48
+
HTTP {{HTTP}} clients can discover a variety of information about a resource by interacting with it. For example, the methods supported can be learned through the Allow response header field, and the need for authentication is conveyed with a 401 (Authentication Required) status code.
43
49
44
-
Often, it can be beneficial to know this information before interacting with the resource; not only can such knowledge save time (through reduced round trips), but it can also affect the choices available to the code or user driving the interaction.
50
+
Often, it can be beneficial to know this information before interacting with the resource; not only can such knowledge save time (through reduced round trips), but it can also influence the choices made by the code or user driving the interaction.
45
51
46
52
For example, a user interface that presents the data from an HTTP-based API might need to know which resources the user has write access to, so that it can present the appropriate interface.
47
53
48
-
This specification defines a vocabulary of "HTTP link hints" that allow such metadata about HTTP resources to be attached to Web links {{!RFC8288}}, thereby making it available before the link is followed. It also establishes a registry for future hints.
54
+
This specification defines a vocabulary of "HTTP link hints" that allow such metadata about HTTP resources to be attached to Web links {{WEB-LINKING}}, thereby making it available before the link is followed. It also establishes a registry for future hints.
49
55
50
56
Hints are just that -- they are not a "contract", and are to only be taken as advisory. The runtime behaviour of the resource always overrides hinted information.
51
57
52
-
For example, a client might receive a hint that the PUT method is allowed on all "widget" resources. This means that generally, the client can PUT to them, but a specific resource might reject a PUT based upon access control or other considerations.
58
+
For example, a client might receive a hint that the PUT method is allowed on all "widget" resources. This means that generally, the client can send a PUT to them, but a specific resource might reject a PUT based upon access control or other considerations.
53
59
54
60
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).
55
61
56
-
There is not a single way to carry hints in a link; rather, it is expected that this will be done by individual link serialisations (see {{!RFC8288}}, Section 3.4.1). However, {{link_header}} does recommend how to include link hints in the existing Link HTTP header field.
62
+
There is not a single way to carry hints in 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.
57
63
58
64
59
65
## Notational Conventions
@@ -63,9 +69,9 @@ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "S
63
69
64
70
# HTTP Link Hints {#link_hints}
65
71
66
-
A HTTP link hint is a (key, value) tuple that describes the target resource of a Web link {{!RFC8288}}, or the link itself. The value's canonical form is a JSON {{!RFC8259}} data structure specific to that hint.
72
+
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.
67
73
68
-
Typically, link hints are serialised in links as target attributes ({{!RFC8288}}, Section 3.4.1).
74
+
Typically, link hints are serialised in links as target attributes ({{Section 3.4.1 of WEB-LINKING}}).
69
75
70
76
In JSON-based formats, this can be achieved by simply serialising link hints as an object; for example:
71
77
@@ -87,9 +93,9 @@ In JSON-based formats, this can be achieved by simply serialising link hints as
87
93
}
88
94
~~~
89
95
90
-
In other link formats, this requires a mapping from the canonical JSON data model. One such mapping is described in {{link_header}} for the Link HTTP header field.
96
+
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.
91
97
92
-
The information in a link hint SHOULD NOT be considered valid for longer than the freshness lifetime ({{!RFC7234}}, Section 4.2) of the representation that the link occurred within, and in some cases, it might be valid for a considerably shorter period.
98
+
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.
93
99
94
100
Likewise, the information in a link hint is specific to the link it is attached to. This means that if a representation is specific to a particular user, the hints on links in that representation are also specific to that user.
95
101
@@ -104,7 +110,7 @@ Likewise, the information in a link hint is specific to the link it is attached
104
110
* Content Model: array (of strings)
105
111
* Specification: \[this document]
106
112
107
-
Content MUST be an array of strings, containing HTTP methods ({{!RFC7231}}, Section 4).
113
+
Content MUST be an array of strings, containing HTTP methods ({{Section 9 of HTTP}}).
108
114
109
115
## formats
110
116
@@ -113,9 +119,9 @@ Content MUST be an array of strings, containing HTTP methods ({{!RFC7231}}, Sect
113
119
* Content Model: object
114
120
* Specification: \[this document]
115
121
116
-
Content MUST be an object, whose keys are media types ({{!RFC7231}}, Section 3.1.1.1), and values are objects.
122
+
Content MUST be an object, whose keys are media types ({{Section 8.3.1 of HTTP}}), and values are objects.
117
123
118
-
The object MAY have a "links" member, whose value is an object representing links (in the sense of {{!RFC8288}}) whose context is any document that uses that format. Generally, this will be schema or profile ({{?RFC6906}}) information. The "links" member has the same format as the "links" hint.
124
+
The object MAY have a "links" member, whose value is an object representing links (in the sense of {{WEB-LINKING}}) whose context is any document that uses that format. Generally, this will be schema or profile ({{?RFC6906}}) information. The "links" member has the same format as the "links" hint.
119
125
120
126
Furthermore, the object MAY have a "deprecated" member, whose value is either true or false, indicating whether support for the format might be removed in the near future.
121
127
@@ -129,9 +135,9 @@ All other members of the object are under control of the corresponding media typ
129
135
* Content Model: object
130
136
* Specification: \[this document]
131
137
132
-
The "links" hint contains links (in the sense of {{!RFC8288}}) whose context is the hinted target resource, which are stable for the lifetime of the hint.
138
+
The "links" hint contains links (in the sense of {{WEB-LINKING}}) whose context is the hinted target resource, which are stable for the lifetime of the hint.
133
139
134
-
Content MUST be an object, whose member names are link relations ({{!RFC8288}}) and values are objects that MUST have an "href" member whose value is a URI-reference ({{!RFC3986}}, using the original link as the base for resolution) for the link hint's target resource, and MAY itself contain link hints, serialised as the value for a "hints" member.
140
+
Content MUST be an object, whose member names are link relations ({{WEB-LINKING}}) and values are objects that MUST have an "href" member whose value is a URI-reference ({{URI}}, using the original link as the base for resolution) for the link hint's target resource, and MAY itself contain link hints, serialised as the value for a "hints" member.
135
141
136
142
For example:
137
143
@@ -166,18 +172,18 @@ When this hint is present, "POST" SHOULD be listed in the "allow" hint.
166
172
* Content Model: array (of strings)
167
173
* Specification: \[this document]
168
174
169
-
Content MUST be an array of strings, containing media types ({{!RFC7231}}, Section 3.1.1.1).
175
+
Content MUST be an array of strings, containing media types ({{Section 8.3.1 of HTTP}}) that identify the acceptable patch formats.
170
176
171
177
When this hint is present, "PATCH" SHOULD be listed in the "allow" hint.
172
178
173
179
## accept-ranges
174
180
175
181
* Hint Name: accept-ranges
176
-
* Description: Hints the range-specifier(s) available for the target resource; equivalent to the Accept-Ranges HTTP response header {{!RFC7233}}.
182
+
* Description: Hints the range-specifier(s) available for the target resource; equivalent to the Accept-Ranges HTTP response header {{HTTP}}.
177
183
* Content Model: array (of strings)
178
184
* Specification: \[this document]
179
185
180
-
Content MUST be an array of strings, containing HTTP range-specifiers ({{!RFC7233}}, Section 3.1).
186
+
Content MUST be an array of strings, containing HTTP ranges-specifiers ({{Section 14.1.1 of HTTP}}).
181
187
182
188
## accept-prefer
183
189
@@ -186,12 +192,12 @@ Content MUST be an array of strings, containing HTTP range-specifiers ({{!RFC723
186
192
* Content Model: array (of strings)
187
193
* Specification: \[this document]
188
194
189
-
Content MUST be an array of strings, contain preferences ({{!RFC7240}}, Section 2). Note that, by its nature, a preference can be ignored by the server.
195
+
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.
190
196
191
197
## precondition-req
192
198
193
199
* Hint Name: precondition-req
194
-
* Description: Hints that the target resource requires state-changing requests (e.g., PUT, PATCH) to include a precondition, as per {{!RFC7232}}, to avoid conflicts due to concurrent updates.
200
+
* 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.
195
201
* Content Model: array (of strings)
196
202
* Specification: \[this document]
197
203
@@ -202,11 +208,11 @@ See also the 428 Precondition Required status code ({{!RFC6585}}).
202
208
## auth-schemes
203
209
204
210
* Hint Name: auth-schemes
205
-
* Description: Hints that the target resource requires authentication using the HTTP Authentication Framework {{!RFC7235}}.
211
+
* Description: Hints that the target resource requires authentication using the HTTP Authentication framework {{Section 11 of HTTP}}.
206
212
* Content Model: array (of objects)
207
213
* Specification: \[this document]
208
214
209
-
Content MUST be an array of objects, each with a "scheme" member containing a string that corresponds to a HTTP authentication scheme ({{!RFC7235}}), and optionally a "realms" member containing an array of zero to many strings that identify protection spaces that the resource is a member of.
215
+
Content MUST be an array of objects, each with a "scheme" member containing a string that corresponds 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.
210
216
211
217
For example:
212
218
@@ -231,7 +237,7 @@ For example:
231
237
Content MUST be a string; possible values are:
232
238
233
239
* "deprecated" - indicates that use of the resource is not recommended, but it is still available.
234
-
* "gone" - indicates that the resource is no longer available; i.e., it will return a 410 Gone HTTP status code if accessed.
240
+
* "gone" - indicates that the resource is no longer available; i.e., it will return a 410 (Gone) HTTP status code if accessed.
235
241
236
242
237
243
@@ -250,9 +256,9 @@ Link hints are generic; that is, they are potentially applicable to any HTTP res
250
256
251
257
Hint names MUST be composed of the lowercase letters (a-z), digits (0-9), underscores ("_") and hyphens ("-"), and MUST begin with a lowercase letter.
252
258
253
-
Hint content MUST be described in terms of JSON values ({{!RFC8259}}, Section 3).
259
+
Hint content MUST be described in terms of JSON values ({{Section 3 of JSON}}).
254
260
255
-
Hint semantics SHOULD be described in terms of the framework defined in {{!RFC8288}}.
261
+
Hint semantics SHOULD be described in terms of the framework defined in {{WEB-LINKING}}.
256
262
257
263
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:
258
264
@@ -268,9 +274,9 @@ Initial registrations are enumerated in {{hints}}. The "rel", "rev", "hreflang",
268
274
269
275
# Representing Link Hints in Link Headers {#link_header}
270
276
271
-
A link hint can be represented in a Link header ({{!RFC8288}}, Section 3) as a link-extension.
277
+
A link hint can be represented in a Link header ({{Section 3 of WEB-LINKING}}) as a link-extension.
272
278
273
-
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 {{!RFC8259}} Section 7; otherwise, they MUST be discarded.
279
+
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.
274
280
275
281
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.
0 commit comments