idnits 2.17.1 draft-ietf-httpapi-linkset-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There is 1 instance of too long lines in the document, the longest one being 10 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (January 14, 2021) is 1195 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- -- Looks like a reference, but probably isn't: '1' on line 1079 -- Looks like a reference, but probably isn't: '2' on line 1147 ** Obsolete normative reference: RFC 6982 (Obsoleted by RFC 7942) ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 5988 (Obsoleted by RFC 8288) Summary: 4 errors (**), 0 flaws (~~), 1 warning (==), 4 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group E. Wilde 3 Internet-Draft Axway 4 Intended status: Informational H. Van de Sompel 5 Expires: July 18, 2021 Data Archiving and Networked Services 6 January 14, 2021 8 Linkset: Media Types and a Link Relation Type for Link Sets 9 draft-ietf-httpapi-linkset-00 11 Abstract 13 This specification defines two document formats and respective media 14 types for representing sets of links as stand-alone resources. One 15 format is JSON-based, the other aligned with the format for 16 representing links in the HTTP "Link" header field. This 17 specification also introduces a link relation type to support 18 discovery of sets of links. 20 Note to Readers 22 Please discuss this draft on the "Building Blocks for HTTP APIs" 23 mailing list (). 25 Online access to all versions and files is available on GitHub 26 (). 28 Status of This Memo 30 This Internet-Draft is submitted in full conformance with the 31 provisions of BCP 78 and BCP 79. 33 Internet-Drafts are working documents of the Internet Engineering 34 Task Force (IETF). Note that other groups may also distribute 35 working documents as Internet-Drafts. The list of current Internet- 36 Drafts is at https://datatracker.ietf.org/drafts/current/. 38 Internet-Drafts are draft documents valid for a maximum of six months 39 and may be updated, replaced, or obsoleted by other documents at any 40 time. It is inappropriate to use Internet-Drafts as reference 41 material or to cite them other than as "work in progress." 43 This Internet-Draft will expire on July 18, 2021. 45 Copyright Notice 47 Copyright (c) 2021 IETF Trust and the persons identified as the 48 document authors. All rights reserved. 50 This document is subject to BCP 78 and the IETF Trust's Legal 51 Provisions Relating to IETF Documents 52 (https://trustee.ietf.org/license-info) in effect on the date of 53 publication of this document. Please review these documents 54 carefully, as they describe your rights and restrictions with respect 55 to this document. Code Components extracted from this document must 56 include Simplified BSD License text as described in Section 4.e of 57 the Trust Legal Provisions and are provided without warranty as 58 described in the Simplified BSD License. 60 Table of Contents 62 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 63 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 64 3. Scenarios . . . . . . . . . . . . . . . . . . . . . . . . . . 3 65 3.1. Third-Party Links . . . . . . . . . . . . . . . . . . . . 4 66 3.2. Challenges Writing to HTTP Link Header Field . . . . . . 4 67 3.3. Large Number of Links . . . . . . . . . . . . . . . . . . 5 68 4. Document Formats for Sets of Links . . . . . . . . . . . . . 5 69 4.1. HTTP Link Document Format: application/linkset . . . . . 6 70 4.2. JSON Document Format: application/linkset+json . . . . . 6 71 4.2.1. Set of Links . . . . . . . . . . . . . . . . . . . . 7 72 4.2.2. Link Context Object . . . . . . . . . . . . . . . . . 7 73 4.2.3. Link Target Object . . . . . . . . . . . . . . . . . 8 74 4.2.4. Link Target Attributes . . . . . . . . . . . . . . . 9 75 5. The "linkset" Relation Type for Linking to a Set of Links . . 13 76 6. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 14 77 6.1. Set of Links Provided as application/linkset . . . . . . 14 78 6.2. Set of Links Provided as application/linkset+json . . . . 15 79 6.3. Discovering a Link Set via the "linkset" Link Relation 80 Type . . . . . . . . . . . . . . . . . . . . . . . . . . 18 81 7. Implementation Status . . . . . . . . . . . . . . . . . . . . 18 82 7.1. GS1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 83 7.2. Open Journal Systems (OJS) . . . . . . . . . . . . . . . 19 84 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 19 85 8.1. Link Relation Type: linkset . . . . . . . . . . . . . . . 19 86 8.2. Media Type: application/linkset . . . . . . . . . . . . . 20 87 8.2.1. IANA Considerations . . . . . . . . . . . . . . . . . 20 88 8.3. Media Type: application/linkset+json . . . . . . . . . . 21 89 9. Security Considerations . . . . . . . . . . . . . . . . . . . 22 90 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 23 91 10.1. Normative References . . . . . . . . . . . . . . . . . . 23 92 10.2. Informative References . . . . . . . . . . . . . . . . . 24 94 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 24 95 Appendix B. JSON-LD Context . . . . . . . . . . . . . . . . . . 24 96 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 29 98 1. Introduction 100 Resources on the Web often use typed Web Links [RFC8288], either 101 embedded in resource representations, for example using the 102 element for HTML documents, or conveyed in the HTTP "Link" header for 103 documents of any media type. In some cases, however, providing links 104 in this manner is impractical or impossible and delivering a set of 105 links as a stand-alone document is preferable. 107 Therefore, this specification defines two document formats and 108 associated media types to represent sets of links. It also defines 109 the "linkset" relation type that supports discovery of any resource 110 that conveys a set of links as a stand-alone document. 112 2. Terminology 114 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 115 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 116 "OPTIONAL" in this document are to be interpreted as described in BCP 117 14 [RFC2119] [RFC8174] when, and only when, they appear in all 118 capitals, as shown here. 120 This specification uses the terms "link context" and "link target" as 121 defined in [RFC8288]. These terms respectively correspond with 122 "Context IRI" and "Target IRI" as used in [RFC5988]. Although 123 defined as IRIs, in common scenarios they are also URIs. 125 In the examples provided in this document, links in the HTTP "Link" 126 header are shown on separate lines in order to improve readability. 127 Note, however, that as per Section 3.2 of [RFC7230], line breaks are 128 not allowed in values for HTTP headers; only whitespaces and tabs are 129 supported as seperators. 131 3. Scenarios 133 The following sections outline scenarios in which providing links by 134 means of a standalone document instead of in an HTTP "Link" header 135 field or as links embedded in the resource representation is 136 advantageous or necessary. 138 For all scenarios, links could be provided by means of a stand-alone 139 document that is formatted according to the JSON-based serialization, 140 the serialization aligned with the HTTP "Link" header format, or 141 both. The former serialization is motivated by the widespread use of 142 JSON and related tools, which suggests that handling sets of links 143 expressed as JSON documents should be attractive to developers. The 144 latter serialization is provided for compatibility with the existing 145 serialization used in the HTTP "Link" header and to allow reuse of 146 tools created to handle it. 148 It is important to keep in mind that when providing links by means of 149 a standalone representation, other links can still be provided using 150 other approaches, i.e. it is possible combine various mechanisms to 151 convey links. 153 3.1. Third-Party Links 155 In some cases it is useful that links pertaining to a resource are 156 provided by a server other than the one that hosts the resource. For 157 example, this allows: 159 o Providing links in which the resource is involved not just as link 160 context but also as link target. 162 o Providing links pertaining to the resource that the server hosting 163 that resource is not aware of. 165 o External management of links pertaining to the resource in a 166 special-purpose link management service. 168 In such cases, links pertaining to a resource can be provided by 169 another, specific resource. That specific resource may be managed by 170 the same or by another custodian as the resource to which the links 171 pertain. For clients intent on consuming links provided in that 172 manner, it would be beneficial if the following conditions were met: 174 o Links are provided in a document that uses a well-defined media 175 type. 177 o The resource to which the provided links pertain is able to link 178 to the resource that provides these links using a well-known link 179 relation type. 181 These requirements are addressed in this specification through the 182 definition of two media types and a link relation type, respectively. 184 3.2. Challenges Writing to HTTP Link Header Field 186 In some cases, it is not straightforward to write links to the HTTP 187 "Link" header field from an application. This can, for example, be 188 the case because not all required link information is available to 189 the application or because the application does not have the 190 capability to directly write HTTP headers. In such cases, providing 191 links by means of a standalone document can be a solution. Making 192 the resource that provides these links discoverable can be achieved 193 by means of a typed link. 195 3.3. Large Number of Links 197 When conveying links in an HTTP "Link" header field, it is possible 198 for the size of the HTTP response header to become unpredictable. 199 This can be the case when links are determined dynamically dependent 200 on a range of contextual factors. It is possible to statically 201 configure a web server to correctly handle large HTTP response 202 headers by specifying an upper bound for their size. But when the 203 number of links is unpredictable, estimating a reliable upper bound 204 is challenging. 206 HTTP [RFC7231] defines error codes related to excess communication by 207 the user agent ("413 Request Entity Too Large" and "414 Request-URI 208 Too Long"), but no specific error codes are defined to indicate that 209 response header content exceeds the upper bound that can be handled 210 by the server, and thus it has been truncated. As a result, 211 applications take counter measures aimed at controlling the size of 212 the HTTP "Link" header field, for example by limiting the links they 213 provide to those with select relation types, thereby limiting the 214 value of the HTTP "Link" header field to clients. Providing links by 215 means of a standalone document overcomes challenges related to the 216 unpredictable nature of the size of HTTP "Link" header fields. 218 4. Document Formats for Sets of Links 220 This section specifies two document formats to convey a set of links. 221 Both are based on the abstract model specified in Section 2 of Web 222 Linking [RFC8288] that defines a link as consisting of a "link 223 context", a "link relation type", a "link target", and optional 224 "target attributes": 226 o The format defined in Section 4.1 is identical to the payload of 227 the HTTP "Link" header field as specified in Web Linking 228 [RFC8288]. 230 o The format defined in Section 4.2 is based on JSON [RFC8259]. 232 Note that [RFC8288] deprecates the "rev" construct that was provided 233 by [RFC5988] as a means to express links with a directionality that 234 is the inverse of direct links that use the "rel" construct. In both 235 serializations for link sets defined here, inverse links SHOULD be 236 represented as direct links using the "rel" construct and by 237 switching the position of the resources involved in the link. 239 4.1. HTTP Link Document Format: application/linkset 241 This document format is identical to the payload of the HTTP "Link" 242 header field as defined in Section 3 of [RFC8288], more specifically 243 by its ABNF production rule for "Link" and subsequent ones. 245 The assigned media type for this format is "application/linkset". 247 In order to support use cases where "application/linkset" documents 248 are re-used outside the context of an HTTP interaction, it is 249 RECOMMENDED to make them self-contained by adhering to the following 250 guidelines: 252 o For every link provided in the set of links, explicitly provide 253 the link context using the "anchor" attribute. 255 o For link context ("anchor" attribute) and link target ("href" 256 attribute), use absolute URIs (as defined in Section 4.3 of 257 [RFC3986]). 259 If these recommendations are not followed, interpretation of links in 260 "application/linkset" documents will depend on which URI is used as 261 context. 263 4.2. JSON Document Format: application/linkset+json 265 This document format uses JSON [RFC8259] as the syntax to represent a 266 set of links. The set of links follows the abstract model defined by 267 Web Linking [RFC8288]. 269 The assigned media type for this format is "application/ 270 linkset+json". 272 In order to support use cases where "application/linkset+json" 273 documents are re-used outside the context of an HTTP interaction, it 274 is RECOMMENDED to make them self-contained by adhering to the 275 following guidelines: 277 o For every link provided in the set of links, explicitly provide 278 the link context using the "anchor" member. 280 o For link context ("anchor" member) and link target ("href" 281 member), use absolute URIs (as defined in Section 4.3 of 282 [RFC3986]). 284 If these recommendations are not followed, interpretation of 285 "application/linkset+json" will depend on which URI is used as 286 context URI. 288 The "application/linkset+json" serialization is designed such that it 289 can directly be used as the content of a JSON-LD serialization by 290 adding an appropriate context. Appendix B shows an example of a 291 possible context that, when added to a JSON serialization, allows it 292 to be interpreted as RDF. 294 4.2.1. Set of Links 296 In the JSON representation of a set of links: 298 o A set of links MUST be represented as a JSON object which MUST 299 have "linkset" as its sole member. 301 o The "linkset" member is an array in which a distinct JSON object - 302 the "link context object" (see Section 4.2.2) - MUST be used to 303 represent links that have the same link context. 305 o If necessary, the "linkset" member MAY contain information in 306 addition to link context objects, in which case that information 307 MUST NOT change the semantics of the links provided by those link 308 context objects. 310 o Even if there is only one link context object, it MUST be wrapped 311 in an array. Members other than link context objects MUST NOT be 312 included in this array. 314 4.2.2. Link Context Object 316 In the JSON representation one or more links that have the same link 317 context are represented by a JSON object, the link context object. A 318 link context object adheres to the following rules: 320 o Each link context object MUST have an "anchor" member with a value 321 that represents the link context. This value SHOULD be an 322 absolute URI as defined in Section 4.3 of [RFC3986]. Cases 323 whereby no value is to be provided for the "anchor" member (i.e. 324 the resource providing the set of links is the link context for 325 each link in the link context object) MUST be handled by providing 326 an "anchor" member with null value ("anchor": ""). 328 o For each distinct relation type that the link context has with 329 link targets, a link context object MUST have an additional 330 member. This member is an array in which a distinct JSON object - 331 the "link target object" (see Section 4.2.3) - MUST be used for 332 each link target for which the relationship with the link context 333 (value of the encompassing anchor member) applies. The name of 334 this member expresses the relation type of the link as follows: 336 o 338 * For registered relation types [RFC8288], the name of this 339 member is the registered name of the relation type. 341 * For extension relation types [RFC8288], the name of this member 342 is the URI that uniquely represents the relation type. 344 o Even if there is only one link target object it MUST be wrapped in 345 an array. Members other than link target objects MUST NOT be 346 included in this array. 348 4.2.3. Link Target Object 350 In the JSON representation a link target is represented by a JSON 351 object, the link target object. A link target object adheres to the 352 following rules: 354 o Each link target object MUST have an "href" member with a value 355 that represents the link target. This value SHOULD be an absolute 356 URI as defined in Section 4.3 of [RFC3986]. Cases whereby no 357 value is to be provided for the "href" member (i.e. the resource 358 providing the set of links is the target of the link in the link 359 target object) MUST be handled by providing an "href" member with 360 null value ("href": ""). 362 o In many cases, a link target is further qualified by target 363 attributes. Various types of attributes exist and they are 364 conveyed as additional members of the link target object as 365 detailed in Section 4.2.4. 367 The following example of a JSON-serialized set of links represents 368 one link with its core components: link context, link relation type, 369 and link target. 371 { 372 "linkset": 373 [ 374 { "anchor": "http://example.net/bar", 375 "next": [ 376 {"href": "http://example.com/foo"} 377 ] 378 } 379 ] 380 } 381 The following example of a JSON-serialized set of links represents 382 two links that share link context and relation type but have 383 different link targets. 385 { 386 "linkset": 387 [ 388 { "anchor": "http://example.net/bar", 389 "item": [ 390 {"href": "http://example.com/foo1"}, 391 {"href": "http://example.com/foo2"} 392 ] 393 } 394 ] 395 } 397 The following example shows a set of links that represents two links, 398 each with a different link context, link target, and relation type. 399 One relation type is registered, the other is an extension relation 400 type. 402 { 403 "linkset": 404 [ 405 { "anchor": "http://example.net/bar", 406 "next": [ 407 {"href": "http://example.com/foo1"} 408 ] 409 }, 410 { "anchor": "http://example.net/boo", 411 "http://example.com/relations/baz" : [ 412 {"href": "http://example.com/foo2"} 413 ] 414 } 415 ] 416 } 418 4.2.4. Link Target Attributes 420 A link may be further qualified by target attributes. Three types of 421 attributes exist: 423 o Attributes defined by the serialization of Web Linking [RFC8288]. 425 o Extension attributes defined and used by communities as allowed by 426 [RFC8288]. 428 o Internationalized versions of the "title" attribute defined by 429 [RFC8288] and of extension attributes allowed by [RFC8288]. 431 The handling of these different types of attributes is described in 432 the sections below. 434 4.2.4.1. Target Attributes Defined by Web Linking 436 RFC 8288 defines the following target attributes that may be used to 437 annotate links: "hreflang", "media", "title", "title*", and "type"; 438 these target attributes follow different occurrence and value 439 patterns. In the JSON representation, these attributes MUST be 440 conveyed as additional members of the link target object as follows: 442 o "hreflang": The optional and repeatable "hreflang" target 443 attribute MUST be represented by an array (even if there only is 444 one value to be represented), and each value in that array MUST be 445 a string - representing one value of the "hreflang" target 446 attribute for a link - which follows the same model as in the 447 [RFC8288] syntax. 449 o "media": The optional and not repeatable "media" target attribute 450 MUST be represented by a "media" member in the link target object, 451 and its value MUST be a string that follows the same model as in 452 the [RFC8288] syntax. 454 o "type": The optional and not repeatable "type" target attribute 455 MUST be represented by a "type" member in the link target object, 456 and its value MUST be a string that follows the same model as in 457 the [RFC8288] syntax. 459 o "title": The optional and not repeatable "title" target attribute 460 MUST be represented by a "title" member in the link target object, 461 and its value MUST be a string that follows the same model as in 462 the [RFC8288] syntax. 464 o "title*": The optional and not repeatable "title*" target 465 attribute is motivated by character encoding and language issues 466 and follows the model defined in [RFC8187]. The details of the 467 JSON representation that applies to title* are described in 468 Section 4.2.4.2. 470 The following example illustrates how the repeatable "hreflang" and 471 the not repeatable "type" target attributes are represented in a link 472 target object. 474 { 475 "linkset": 476 [ 477 { "anchor": "http://example.net/bar", 478 "next": [ 479 {"href": "http://example.com/foo", 480 "type": "text/html", 481 "hreflang": [ "en" , "de" ] 482 } 483 ] 484 } 485 ] 486 } 488 4.2.4.2. Internationalized Target Attributes 490 In addition to the target attributes described in Section 4.2.4.1, 491 [RFC8288] also supports attributes that follow the content model of 492 [RFC8187]. In [RFC8288], these target attributes are recognizable by 493 the use of a trailing asterisk in the attribute name, such as 494 "title*". The content model of [RFC8187] uses a string-based 495 microsyntax that represents the character encoding, an optional 496 language tag, and the escaped attribute value encoded according to 497 the specified character encoding. 499 The JSON serialization for these target attributes MUST be as 500 follows: 502 o An internationalized target attribute is represented as a member 503 of the link context object with the same name (including the *) of 504 the attribute. 506 o The character encoding information as prescribed by [RFC8187] is 507 not preserved; instead, the content of the internationalized 508 attribute is represented in the character encoding used for the 509 JSON set of links. 511 o The value of the internationalized target attribute is an array 512 that contains one or more JSON objects. The name of the first 513 member of such JSON object is "value" and its value is the actual 514 content (in its unescaped version) of the internationalized target 515 attribute, i.e. the value of the attribute from which the encoding 516 and language information are removed. The name of the optional 517 second member of such JSON object is "language" and its value is 518 the language tag [RFC5646] for the language in which the attribute 519 content is conveyed. 521 The following example illustrates how the "title*" target attribute 522 defined by [RFC8288] is represented in a link target object. 524 { 525 "linkset": 526 [ 527 { "anchor": "http://example.net/bar", 528 "next": [ 529 {"href": "http://example.com/foo", 530 "type": "text/html", 531 "hreflang": [ "en" , "de" ], 532 "title": "Next chapter", 533 "title*": [ { "value": "nachstes Kapitel" , "language" : "de" } ] 534 } 535 ] 536 } 537 ] 538 } 540 The above example assumes that the German title contains an umlaut 541 character (in the native syntax it would be encoded as title*=UTF- 542 8'de'n%c3%a4chstes%20Kapitel), which gets encoded in its unescaped 543 form in the JSON representation. This is not shown in the above 544 example due to the limitations of RFC publication. Implementations 545 MUST properly decode/encode internationalized target attributes that 546 follow the model of [RFC8187] when transcoding between the 547 "application/linkset" and the "application/linkset+json" formats. 549 4.2.4.3. Extension Target Attributes 551 Extension target attributes are attributes that are not defined by 552 RFC 8288 (as listed in Section 4.2.4.1), but are nevertheless used to 553 qualify links. They can be defined by communities in any way deemed 554 necessary, and it is up to them to make sure their usage is 555 understood by target applications. However, lacking standardization, 556 there is no interoperable understanding of these extension 557 attributes. One important consequence is that their cardinality is 558 unknown to generic applications. Therefore, in the JSON 559 serialization, all extension target attributes are treated as 560 repeatable. 562 The JSON serialization for these target attributes MUST be as 563 follows: 565 o An extension target attribute is represented as a member of the 566 link context object with the same name of the attribute, including 567 the * if applicable. 569 o The value of an extension attribute MUST be represented by an 570 array, even if there only is one value to be represented. 572 o If the extension target attribute does not have a name with a 573 trailing asterisk, then each value in that array MUST be a string 574 that represents one value of the attribute. 576 o If the extension attribute has a name with a trailing asterisk (it 577 follows the content model of [RFC8187]), then each value in that 578 array MUST be a JSON object. The value of each such JSON object 579 MUST be structured as described in Section 4.2.4.2. 581 The example shows a link target object with three extension target 582 attributes. The value for each extension target attribute is an 583 array. The two first are regular extension target attributes, with 584 the first one ("foo") having only one value and the second one 585 ("bar") having two. The last extension target attribute ("baz*") 586 follows the naming rule of [RFC8187] and therefore is encoded 587 according to the serialization described in Section 4.2.4.2. 589 { 590 "linkset": 591 [ 592 { "anchor": "http://example.net/bar", 593 "next": [ 594 { "href": "http://example.com/foo", 595 "type": "text/html", 596 "foo": [ "foovalue" ], 597 "bar": [ "barone", "bartwo" ], 598 "baz*": [ { "value": "bazvalue" , "language" : "en" } ] 599 } 600 ] 601 } 602 ] 603 } 605 5. The "linkset" Relation Type for Linking to a Set of Links 607 The target of a link with the "linkset" relation type provides a set 608 of links, including links in which the resource that is the link 609 context participates. 611 A link with the "linkset" relation type MAY be provided in the header 612 and/or the body of a resource's representation. It may also be 613 discovered by other means, such as through client-side information. 615 A resource MAY provide more than one link with a "linkset" relation 616 type. Multiple such links can refer to the same set of links 617 expressed using different media types, or to different sets of links, 618 potentially provided by different third-party services. 620 A user agent that follows a "linkset" link MUST be aware that the set 621 of links provided by the resource that is the target of the link can 622 contain links in which the resource that is the context of the link 623 does not participate; it MAY decide to ignore those links. 625 A user agent that follows a "linkset" link and obtains links for 626 which anchors and targets are not expressed as absolute URIs MUST 627 properly determine what the context is for these links; it SHOULD 628 ignore links for which it is unable to unambiguously make that 629 determination. 631 6. Examples 633 Section 6.1 and Section 6.2 show examples whereby the set of links 634 are provided as "application/linkset" and "application/linkset+json" 635 documents, respectively. Section 6.3 illustrates the use of the 636 "linkset" link relation type to support discovery of sets of links. 638 6.1. Set of Links Provided as application/linkset 640 Figure 1 shows a client issuing an HTTP GET request against resource 641 . 643 GET /resource1 HTTP/1.1 644 Host: example.org 645 Connection: close 647 Figure 1: Client HTTP GET request 649 Figure 2 shows the response to the GET request of Figure 1. The 650 response contains a Content-Type header specifying that the media 651 type of the response is "application/linkset". A set of links, 652 including links that pertain to the responding resource, is provided 653 in the response body. 655 HTTP/1.1 200 OK 656 Date: Mon, 12 Aug 2019 10:35:51 GMT 657 Server: Apache-Coyote/1.1 658 Content-Length: 729 659 Content-Type: application/linkset 660 Connection: close 662 663 ; rel="author" 664 ; type="application/rdf+xml" 665 ; anchor="http://example.org/resource1", 666 667 ; rel="author" 668 ; type="application/rdf+xml" 669 ; anchor="http://example.org/resource1", 670 671 ; rel="item" 672 ; type="application/pdf" 673 ; anchor="http://example.org/resource1", 674 675 ; rel="item" 676 ; type="text/html" 677 ; anchor="http://example.org/resource1", 678 679 ; rel="latest-version" 680 ; anchor="http://example.org/resource41/", 681 682 ; rel="prev" 683 ; anchor="http://example.org/resource41/" 685 Figure 2: Response to HTTP GET includes a set of links 687 6.2. Set of Links Provided as application/linkset+json 689 Figure 3 shows the client issuing an HTTP GET request against 690 . In the request, the client 691 uses an "Accept" header to indicate it prefers a response in the 692 "application/linkset+json" format. 694 GET links/article/7507 HTTP/1.1 695 Host: example.com 696 Accept: application/linkset+json 697 Connection: close 699 Figure 3: Client HTTP GET request expressing preference for 700 "application/linkset+json" response 702 Figure 4 shows the response to the HTTP GET request of Figure 3. The 703 set of links is serialized according to the media type "application/ 704 linkset+json". 706 HTTP/1.1 200 OK 707 Date: Mon, 12 Aug 2019 10:46:22 GMT 708 Server: Apache-Coyote/1.1 709 Content-Type: application/linkset+json 710 Content-Length: 802 712 { 713 "linkset": [ 714 { 715 "anchor": "https://example.org/article/view/7507", 716 "author": [ 717 { 718 "href": "https://orcid.org/0000-0002-1825-0097", 719 } 720 ], 721 "item": [ 722 { 723 "href": "https://example.org/article/7507/item/1", 724 "type": "application/pdf" 725 }, 726 { 727 "href": "https://example.org/article/7507/item/2", 728 "type": "text/csv" 729 } 730 ], 731 "cite-as": [ 732 { 733 "href": "https://doi.org/10.5555/12345680", 734 "title": "A Methodology for the Emulation of Architecture" 735 } 736 ] 737 }, 738 { 739 "anchor": "https://example.com/links/article/7507", 740 "alternate": [ 741 { 742 "href": "https://mirror.example.com/links/article/7507", 743 "type": "application/linkset" 744 } 745 ] 746 } 747 ] 748 } 750 Figure 4: Response to the client's request for the set of links 752 6.3. Discovering a Link Set via the "linkset" Link Relation Type 754 Figure 5 shows a client issuing an HTTP HEAD request against resource 755 . 757 HEAD article/view/7507 HTTP/1.1 758 Host: example.org 759 Connection: close 761 Figure 5: Client HTTP HEAD request 763 Figure 6 shows the response to the HEAD request of Figure 5. The 764 response contains a "Link" header with a link that has the "linkset" 765 relation type. It indicates that a set of links is provided by 766 resource , which provides a 767 representation with media type "application/linkset+json". 769 HTTP/1.1 200 OK 770 Date: Mon, 12 Aug 2019 10:45:54 GMT 771 Server: Apache-Coyote/1.1 772 Link: 773 ; rel="linkset" 774 ; type="application/linkset+json" 775 Content-Length: 236 776 Content-Type: text/html;charset=utf-8 777 Connection: close 779 Figure 6: Response to HTTP HEAD request 781 Section 6.2 shows a client obtaining a set of links by issuing an 782 HTTP GET on the target of the link with the "linkset" relation type, 783 . 785 7. Implementation Status 787 Note to RFC Editor: Please remove this section before publication. 789 This section records the status of known implementations of the 790 protocol defined by this specification at the time of posting of this 791 Internet-Draft, and is based on a proposal described in RFC 6982 792 [RFC6982]. The description of implementations in this section is 793 intended to assist the IETF in its decision processes in progressing 794 drafts to RFCs. Please note that the listing of any individual 795 implementation here does not imply endorsement by the IETF. 796 Furthermore, no effort has been spent to verify the information 797 presented here that was supplied by IETF contributors. This is not 798 intended as, and must not be construed to be, a catalog of available 799 implementations or their features. Readers are advised to note that 800 other implementations may exist. 802 According to RFC 6982, "this will allow reviewers and working groups 803 to assign due consideration to documents that have the benefit of 804 running code, which may serve as evidence of valuable experimentation 805 and feedback that have made the implemented protocols more mature. 806 It is up to the individual working groups to use this information as 807 they see fit". 809 7.1. GS1 811 GS1 is a provider of barcodes (GS1 GTINs and EAN/UPC) for retail 812 products and manages an ecology of services and standards to leverage 813 them at a global scale. GS1 has indicated that it will implement 814 this "linkset" specification as a means to allow requesting and 815 representing links pertaining to products from various retailers. 816 Currently, the GS1 Digital Link specification makes an informative 817 reference to version 03 of the "linkset" I-D. GS1 expresses 818 confidence that this will become a normative reference in the next 819 iteration of that specification, likely to be ratified as a GS1 820 standard around February 2021. 822 7.2. Open Journal Systems (OJS) 824 Open Journal Systems (OJS) is an open-source software for the 825 management of peer-reviewed academic journals, and is created by the 826 Public Knowledge Project (PKP), released under the GNU General Public 827 License. Open Journal Systems (OJS) is a journal management and 828 publishing system that has been developed by PKP through its 829 federally funded efforts to expand and improve access to research. 831 The OJS platform has implemented "linkset" support as an alternative 832 way to provide links when there are more than a configured limit 833 (they consider using about 10 as a good default, for testing purpose 834 it is currently set to 8). 836 8. IANA Considerations 838 8.1. Link Relation Type: linkset 840 The link relation type below has been registered by IANA per 841 Section 6.2.1 of Web Linking [RFC8288]: 843 Relation Name: linkset 844 Description: The Target IRI of a link with the "linkset" relation 845 type provides a set of links, including links in which the Context 846 IRI of the link participates. 848 Reference: [[ This document ]] 850 8.2. Media Type: application/linkset 852 8.2.1. IANA Considerations 854 The Internet media type [RFC6838] for a natively encoded linkset is 855 application/linkset. 857 Type name: application 859 Subtype name: linkset 861 Required parameters: none 863 Optional parameters: none 865 Encoding considerations: Linksets are encoded according to the 866 definition of [RFC8288]. The encoding of [RFC8288] is based on 867 the general encoding rules of [RFC7230], with the addition of 868 allowing indicating character encoding and language for specific 869 parameters as defined by [RFC8187]. 871 Security considerations: The security considerations of [[ This 872 document ]] apply. 874 Interoperability considerations: The interoperability 875 considerations of [RFC7230] apply. 877 Published specification: [[ This document ]] 879 Applications that use this media type: This media type is not 880 specific to any application, as it can be used by any application 881 that wants to interchange web links. 883 Additional information: 885 Magic number(s): N/A 887 File extension(s): This media type does not propose a specific 888 extension. 890 Macintosh file type code(s): TEXT 892 Person & email address to contact for further information: Erik 893 Wilde 895 Intended usage: COMMON 897 Restrictions on usage: none 899 Author: Erik Wilde 901 Change controller: IETF 903 8.3. Media Type: application/linkset+json 905 The Internet media type [RFC6838] for a JSON-encoded linkset is 906 application/linkset+json. 908 Type name: application 910 Subtype name: linkset+json 912 Required parameters: none 914 Optional parameters: none 916 Encoding considerations: The encoding considerations of [RFC8259] 917 apply 919 Security considerations: The security considerations of [[ This 920 document ]] apply. 922 Interoperability considerations: The interoperability 923 considerations of [RFC8259] apply. 925 Published specification: [[ This document ]] 927 Applications that use this media type: This media type is not 928 specific to any application, as it can be used by any application 929 that wants to interchange web links. 931 Additional information: 933 Magic number(s): N/A 935 File extension(s): JSON documents often use ".json" as the file 936 extension, and this media type does not propose a specific 937 extension other than this generic one. 939 Macintosh file type code(s): TEXT 941 Person & email address to contact for further information: Erik 942 Wilde 944 Intended usage: COMMON 946 Restrictions on usage: none 948 Author: Erik Wilde 950 Change controller: IETF 952 9. Security Considerations 954 The security considerations of Web Linking [RFC8288] apply, as long 955 as they are not specifically discussing the risks of exposing 956 information in HTTP header fields. 958 In general, links may cause information leakage when they expose 959 information (such as URIs) that can be sensitive or private. Links 960 may expose "hidden URIs" that are not supposed to be openly shared, 961 and may not be sufficiently protected. Ideally, none of the URIs 962 exposed in links should be supposed to be "hidden"; instead, if these 963 URIs are supposed to be limited to certain users, then technical 964 measures should be put in place so that accidentally exposing them 965 does not cause any harm. 967 For the specific mechanisms defined in this specification, two 968 security considerations should be taken into account: 970 o The Web Linking model always has an "implicit context", which is 971 the resource of the HTTP interaction. This original context can 972 be lost or can change when self-contained link representations are 973 moved. Changing the context can change the interpretation of 974 links when they have no explicit anchor, or when they use relative 975 URIs. Applications may choose to ignore links that have no 976 explicit anchor or that use relative URIs when these are exchanged 977 in stand-alone resources. 979 o The model introduced in this specification supports "3rd party 980 links", where one party can provide links that have another 981 party's resource as an anchor. Depending on the link semantics 982 and the application context, it is important to verify that there 983 is sufficient trust in that 3rd party to allow it to provide these 984 links. Applications may choose to treat 3rd party links 985 differently than cases where a resource and the links for that 986 resource are provided by the same party. 988 10. References 990 10.1. Normative References 992 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 993 Requirement Levels", BCP 14, RFC 2119, 994 DOI 10.17487/RFC2119, March 1997, 995 . 997 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 998 Resource Identifier (URI): Generic Syntax", STD 66, 999 RFC 3986, DOI 10.17487/RFC3986, January 2005, 1000 . 1002 [RFC5646] Phillips, A., Ed. and M. Davis, Ed., "Tags for Identifying 1003 Languages", BCP 47, RFC 5646, DOI 10.17487/RFC5646, 1004 September 2009, . 1006 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 1007 Specifications and Registration Procedures", BCP 13, 1008 RFC 6838, DOI 10.17487/RFC6838, January 2013, 1009 . 1011 [RFC6982] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 1012 Code: The Implementation Status Section", RFC 6982, 1013 DOI 10.17487/RFC6982, July 2013, 1014 . 1016 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1017 Protocol (HTTP/1.1): Message Syntax and Routing", 1018 RFC 7230, DOI 10.17487/RFC7230, June 2014, 1019 . 1021 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 1022 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 1023 DOI 10.17487/RFC7231, June 2014, 1024 . 1026 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 1027 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 1028 May 2017, . 1030 [RFC8187] Reschke, J., "Indicating Character Encoding and Language 1031 for HTTP Header Field Parameters", RFC 8187, 1032 DOI 10.17487/RFC8187, September 2017, 1033 . 1035 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 1036 Interchange Format", STD 90, RFC 8259, 1037 DOI 10.17487/RFC8259, December 2017, 1038 . 1040 [RFC8288] Nottingham, M., "Web Linking", RFC 8288, 1041 DOI 10.17487/RFC8288, October 2017, 1042 . 1044 10.2. Informative References 1046 [RFC4287] Nottingham, M., Ed. and R. Sayre, Ed., "The Atom 1047 Syndication Format", RFC 4287, DOI 10.17487/RFC4287, 1048 December 2005, . 1050 [RFC5988] Nottingham, M., "Web Linking", RFC 5988, 1051 DOI 10.17487/RFC5988, October 2010, 1052 . 1054 [W3C.REC-json-ld-20140116] 1055 Sporny, M., Kellogg, G., and M. Lanthaler, "JSON-LD 1.0", 1056 World Wide Web Consortium Recommendation REC-json-ld- 1057 20140116, January 2014, 1058 . 1060 10.3. URIs 1062 [1] https://www.w3.org/TR/2014/REC-json-ld-20140116/#interpreting- 1063 json-as-json-ld 1065 [2] https://tools.ietf.org/html/rfc8288#appendix-A.2 1067 Appendix A. Acknowledgements 1069 Thanks for comments and suggestions provided by Phil Archer, 1070 Dominique Guinard, Mark Nottingham, Stian Soiland-Reyes, and Sarven 1071 Capadisli. 1073 Appendix B. JSON-LD Context 1075 A set of links rendered according to the JSON serialization defined 1076 in Section 4.2 can be interpreted as RDF triples by adding a JSON-LD 1077 context [W3C.REC-json-ld-20140116] that maps the JSON keys to 1078 corresponding Linked Data terms. And, as per 1079 [W3C.REC-json-ld-20140116] section 6.8 [1], when delivering a link 1080 set that is rendered according to the "application/linkset+json" 1081 media type to a user agent, a server can convey the availability of 1082 such a JSON-LD context by using a link with the relation type 1083 "http://www.w3.org/ns/json-ld#context" in the HTTP "Link" header. 1085 Using the latter approach to support discovery of a JSON-LD Context, 1086 the response to the GET request of Figure 3 against the URI of a set 1087 of links would be as shown in Figure 7. 1089 HTTP/1.1 200 OK 1090 Date: Mon, 12 Aug 2019 10:48:22 GMT 1091 Server: Apache-Coyote/1.1 1092 Content-Type: application/linkset+json 1093 Link: 1094 ; rel="http://www.w3.org/ns/json-ld#context" 1095 ; type="application/ld+json" 1096 Content-Length: 846 1098 { 1099 "linkset": [ 1100 { 1101 "anchor": "https://example.org/article/view/7507", 1102 "author": [ 1103 { 1104 "href": "https://orcid.org/0000-0002-1825-0097" 1105 } 1106 ], 1107 "item": [ 1108 { 1109 "href": "https://example.org/article/7507/item/1", 1110 "type": "application/pdf" 1111 }, 1112 { 1113 "href": "https://example.org/article/7507/item/2", 1114 "type": "text/csv" 1115 } 1116 ], 1117 "cite-as": [ 1118 { 1119 "href": "https://doi.org/10.5555/12345680", 1120 "title": "A Methodology for the Emulation of Architecture" 1121 } 1122 ] 1123 }, 1124 { 1125 "anchor": "https://example.com/links/article/7507", 1126 "alternate": [ 1127 { 1128 "href": "https://mirror.example.com/links/article/7507", 1129 "type": "application/linkset" 1131 } 1132 ] 1133 } 1134 ] 1135 } 1137 Figure 7: Using a typed link to support discovery of a JSON-LD 1138 Context for a Set of Links 1140 In order to obtain the JSON-LD Context conveyed by the server, the 1141 user agent issues an HTTP GET against the link target of the link 1142 with the "http://www.w3.org/ns/json-ld#context" relation type. The 1143 response to this GET is shown in Figure 8. This particular JSON-LD 1144 context maps "application/linkset+json" representations of link sets 1145 to Dublin Core Terms. It also renders each link relation as an 1146 absolute URI, inspired by the same approach used for Atom [RFC4287] 1147 described in [RFC8288] appendix A.2 [2]. 1149 HTTP/1.1 200 OK 1150 Content-Type: application/ld+json 1151 Content-Length: 638 1153 { 1154 "@context": [ 1155 { 1156 "@vocab": "http://www.iana.org/assignments/relation/", 1157 "anchor": "@id", 1158 "href": "@id", 1159 "linkset": "@graph", 1160 "_linkset": "@graph", 1161 "title": { 1162 "@id": "http://purl.org/dc/terms/title" 1163 }, 1164 "title*": { 1165 "@id": "http://purl.org/dc/terms/title" 1166 }, 1167 "type": { 1168 "@id": "http://purl.org/dc/terms/format" 1169 } 1170 }, 1171 { 1172 "language": "@language", 1173 "value": "@value", 1174 "hreflang": { 1175 "@id": "http://purl.org/dc/terms/language", 1176 "@container": "@set" 1177 } 1178 } 1179 ] 1180 } 1182 Figure 8: JSON-LD Context mapping to schema.org and IANA assignments 1184 Applying the JSON-LD context of Figure 8 to the link set of Figure 7 1185 allows transforming the "application/linkset+json" link set to an RDF 1186 link set. Figure 9 shows the latter represented by means of the 1187 "text/turtle" RDF serialization. 1189 1190 1191 . 1193 1194 1195 . 1197 1198 1199 "application/pdf" . 1201 1202 1203 . 1205 1206 1207 "text/csv" . 1209 1210 1211 . 1213 1214 1215 "A Methodology for the Emulation of Architecture" . 1217 1218 1219 . 1221 1222 1223 "application/linkset" . 1225 Figure 9: RDF serialization of the link set resulting from applying 1226 the JSON-LD context 1228 Note that the JSON-LD context of Figure 8 does not handle (meta)link 1229 relations of type ""linkset"" as they are in conflict with the top- 1230 level JSON key. A workaround is to rename the top-level key to 1231 ""_linkset"" in the "application/linkset+json" before transforming a 1232 link set to JSON-LD. 1234 Authors' Addresses 1236 Erik Wilde 1237 Axway 1239 Email: erik.wilde@dret.net 1240 URI: http://dret.net/netdret/ 1242 Herbert Van de Sompel 1243 Data Archiving and Networked Services 1245 Email: herbert.van.de.sompel@dans.knaw.nl 1246 URI: https://orcid.org/0000-0002-0715-6126