-
Notifications
You must be signed in to change notification settings - Fork 8
/
draft-ietf-httpapi-linkset-02.html
1409 lines (1341 loc) · 77.3 KB
/
draft-ietf-httpapi-linkset-02.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head profile="http://www.w3.org/2006/03/hcard http://dublincore.org/documents/2008/08/04/dc-html/">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
<title>Linkset: Media Types and a Link Relation Type for Link Sets</title>
<style type="text/css" title="Xml2Rfc (sans serif)">
/*<![CDATA[*/
a {
text-decoration: none;
}
/* info code from SantaKlauss at http://www.madaboutstyle.com/tooltip2.html */
a.info {
/* This is the key. */
position: relative;
z-index: 24;
text-decoration: none;
}
a.info:hover {
z-index: 25;
color: #FFF; background-color: #900;
}
a.info span { display: none; }
a.info:hover span.info {
/* The span will display just on :hover state. */
display: block;
position: absolute;
font-size: smaller;
top: 2em; left: -5em; width: 15em;
padding: 2px; border: 1px solid #333;
color: #900; background-color: #EEE;
text-align: left;
}
a.smpl {
color: black;
}
a:hover {
text-decoration: underline;
}
a:active {
text-decoration: underline;
}
address {
margin-top: 1em;
margin-left: 2em;
font-style: normal;
}
body {
color: black;
font-family: verdana, helvetica, arial, sans-serif;
font-size: 10pt;
max-width: 55em;
}
cite {
font-style: normal;
}
dd {
margin-right: 2em;
}
dl {
margin-left: 2em;
}
ul.empty {
list-style-type: none;
}
ul.empty li {
margin-top: .5em;
}
dl p {
margin-left: 0em;
}
dt {
margin-top: .5em;
}
h1 {
font-size: 14pt;
line-height: 21pt;
page-break-after: avoid;
}
h1.np {
page-break-before: always;
}
h1 a {
color: #333333;
}
h2 {
font-size: 12pt;
line-height: 15pt;
page-break-after: avoid;
}
h3, h4, h5, h6 {
font-size: 10pt;
page-break-after: avoid;
}
h2 a, h3 a, h4 a, h5 a, h6 a {
color: black;
}
img {
margin-left: 3em;
}
li {
margin-left: 2em;
margin-right: 2em;
}
ol {
margin-left: 2em;
margin-right: 2em;
}
ol p {
margin-left: 0em;
}
p {
margin-left: 2em;
margin-right: 2em;
}
pre {
margin-left: 3em;
background-color: lightyellow;
padding: .25em;
}
pre.text2 {
border-style: dotted;
border-width: 1px;
background-color: #f0f0f0;
width: 69em;
}
pre.inline {
background-color: white;
padding: 0em;
}
pre.text {
border-style: dotted;
border-width: 1px;
background-color: #f8f8f8;
width: 69em;
}
pre.drawing {
border-style: solid;
border-width: 1px;
background-color: #f8f8f8;
padding: 2em;
}
table {
margin-left: 2em;
}
table.tt {
vertical-align: top;
}
table.full {
border-style: outset;
border-width: 1px;
}
table.headers {
border-style: outset;
border-width: 1px;
}
table.tt td {
vertical-align: top;
}
table.full td {
border-style: inset;
border-width: 1px;
}
table.tt th {
vertical-align: top;
}
table.full th {
border-style: inset;
border-width: 1px;
}
table.headers th {
border-style: none none inset none;
border-width: 1px;
}
table.left {
margin-right: auto;
}
table.right {
margin-left: auto;
}
table.center {
margin-left: auto;
margin-right: auto;
}
caption {
caption-side: bottom;
font-weight: bold;
font-size: 9pt;
margin-top: .5em;
}
table.header {
border-spacing: 1px;
width: 95%;
font-size: 10pt;
color: white;
}
td.top {
vertical-align: top;
}
td.topnowrap {
vertical-align: top;
white-space: nowrap;
}
table.header td {
background-color: gray;
width: 50%;
}
table.header a {
color: white;
}
td.reference {
vertical-align: top;
white-space: nowrap;
padding-right: 1em;
}
thead {
display:table-header-group;
}
ul.toc, ul.toc ul {
list-style: none;
margin-left: 1.5em;
margin-right: 0em;
padding-left: 0em;
}
ul.toc li {
line-height: 150%;
font-weight: bold;
font-size: 10pt;
margin-left: 0em;
margin-right: 0em;
}
ul.toc li li {
line-height: normal;
font-weight: normal;
font-size: 9pt;
margin-left: 0em;
margin-right: 0em;
}
li.excluded {
font-size: 0pt;
}
ul p {
margin-left: 0em;
}
.comment {
background-color: yellow;
}
.center {
text-align: center;
}
.error {
color: red;
font-style: italic;
font-weight: bold;
}
.figure {
font-weight: bold;
text-align: center;
font-size: 9pt;
}
.filename {
color: #333333;
font-weight: bold;
font-size: 12pt;
line-height: 21pt;
text-align: center;
}
.fn {
font-weight: bold;
}
.hidden {
display: none;
}
.left {
text-align: left;
}
.right {
text-align: right;
}
.title {
color: #990000;
font-size: 18pt;
line-height: 18pt;
font-weight: bold;
text-align: center;
margin-top: 36pt;
}
.vcardline {
display: block;
}
.warning {
font-size: 14pt;
background-color: yellow;
}
@media print {
.noprint {
display: none;
}
a {
color: black;
text-decoration: none;
}
table.header {
width: 90%;
}
td.header {
width: 50%;
color: black;
background-color: white;
vertical-align: top;
font-size: 12pt;
}
ul.toc a::after {
content: leader('.') target-counter(attr(href), page);
}
ul.ind li li a {
content: target-counter(attr(href), page);
}
.print2col {
column-count: 2;
-moz-column-count: 2;
column-fill: auto;
}
}
@page {
@top-left {
content: "Internet-Draft";
}
@top-right {
content: "December 2010";
}
@top-center {
content: "Abbreviated Title";
}
@bottom-left {
content: "Doe";
}
@bottom-center {
content: "Expires June 2011";
}
@bottom-right {
content: "[Page " counter(page) "]";
}
}
@page:first {
@top-left {
content: normal;
}
@top-right {
content: normal;
}
@top-center {
content: normal;
}
}
/*]]>*/
</style>
<link href="#rfc.toc" rel="Contents">
<link href="#rfc.section.1" rel="Chapter" title="1 Introduction">
<link href="#rfc.section.2" rel="Chapter" title="2 Terminology">
<link href="#rfc.section.3" rel="Chapter" title="3 Scenarios">
<link href="#rfc.section.3.1" rel="Chapter" title="3.1 Third-Party Links">
<link href="#rfc.section.3.2" rel="Chapter" title="3.2 Challenges Writing to HTTP Link Header Field">
<link href="#rfc.section.3.3" rel="Chapter" title="3.3 Large Number of Links">
<link href="#rfc.section.4" rel="Chapter" title="4 Document Formats for Sets of Links">
<link href="#rfc.section.4.1" rel="Chapter" title="4.1 HTTP Link Document Format: application/linkset">
<link href="#rfc.section.4.2" rel="Chapter" title="4.2 JSON Document Format: application/linkset+json">
<link href="#rfc.section.4.2.1" rel="Chapter" title="4.2.1 Set of Links">
<link href="#rfc.section.4.2.2" rel="Chapter" title="4.2.2 Link Context Object">
<link href="#rfc.section.4.2.3" rel="Chapter" title="4.2.3 Link Target Object">
<link href="#rfc.section.4.2.4" rel="Chapter" title="4.2.4 Link Target Attributes">
<link href="#rfc.section.4.2.5" rel="Chapter" title="4.2.5 JSON Extensibility">
<link href="#rfc.section.5" rel="Chapter" title='5 The "profile" attribute for media types to Represent Sets of Links'>
<link href="#rfc.section.6" rel="Chapter" title='6 The "linkset" Relation Type for Linking to a Set of Links'>
<link href="#rfc.section.7" rel="Chapter" title="7 Examples">
<link href="#rfc.section.7.1" rel="Chapter" title="7.1 Set of Links Provided as application/linkset">
<link href="#rfc.section.7.2" rel="Chapter" title="7.2 Set of Links Provided as application/linkset+json">
<link href="#rfc.section.7.3" rel="Chapter" title='7.3 Discovering a Link Set via the "linkset" Link Relation Type'>
<link href="#rfc.section.8" rel="Chapter" title="8 Implementation Status">
<link href="#rfc.section.8.1" rel="Chapter" title="8.1 GS1">
<link href="#rfc.section.8.2" rel="Chapter" title="8.2 FAIR Signposting Profile">
<link href="#rfc.section.8.3" rel="Chapter" title="8.3 Open Journal Systems (OJS)">
<link href="#rfc.section.9" rel="Chapter" title="9 IANA Considerations">
<link href="#rfc.section.9.1" rel="Chapter" title="9.1 Link Relation Type: linkset">
<link href="#rfc.section.9.2" rel="Chapter" title="9.2 Media Type: application/linkset">
<link href="#rfc.section.9.3" rel="Chapter" title="9.3 Media Type: application/linkset+json">
<link href="#rfc.section.10" rel="Chapter" title="10 Security Considerations">
<link href="#rfc.references" rel="Chapter" title="11 References">
<link href="#rfc.references.1" rel="Chapter" title="11.1 Normative References">
<link href="#rfc.references.2" rel="Chapter" title="11.2 Informative References">
<link href="#rfc.appendix.A" rel="Chapter" title="A Acknowledgements">
<link href="#rfc.appendix.B" rel="Chapter" title="B JSON-LD Context">
<link href="#rfc.authors" rel="Chapter">
<meta name="generator" content="xml2rfc version 3.8.0 - https://tools.ietf.org/tools/xml2rfc" />
<link rel="schema.dct" href="http://purl.org/dc/terms/" />
<meta name="dct.creator" content="Wilde, E. and H. Van de Sompel" />
<meta name="dct.identifier" content="urn:ietf:id:draft-ietf-httpapi-linkset-02" />
<meta name="dct.issued" scheme="ISO8601" content="2021-06-04" />
<meta name="dct.abstract" content="This specification defines two document formats and respective media types for representing sets of links as stand-alone resources. One format is JSON-based, the other aligned with the format for representing links in the HTTP "Link" header field. This specification also introduces a link relation type to support discovery of sets of links. " />
<meta name="description" content="This specification defines two document formats and respective media types for representing sets of links as stand-alone resources. One format is JSON-based, the other aligned with the format for representing links in the HTTP "Link" header field. This specification also introduces a link relation type to support discovery of sets of links. " />
</head>
<body>
<table class="header">
<tbody>
<tr>
<td class="left">Network Working Group</td>
<td class="right">E. Wilde</td>
</tr>
<tr>
<td class="left">Internet-Draft</td>
<td class="right">Axway</td>
</tr>
<tr>
<td class="left">Intended status: Informational</td>
<td class="right">H. Van de Sompel</td>
</tr>
<tr>
<td class="left">Expires: December 6, 2021</td>
<td class="right">Data Archiving and Networked Services</td>
</tr>
<tr>
<td class="left"></td>
<td class="right">June 4, 2021</td>
</tr>
</tbody>
</table>
<p class="title">Linkset: Media Types and a Link Relation Type for Link Sets<br />
<span class="filename">draft-ietf-httpapi-linkset-02</span></p>
<h1 id="rfc.abstract"><a href="#rfc.abstract">Abstract</a></h1>
<p>This specification defines two document formats and respective media types for representing sets of links as stand-alone resources. One format is JSON-based, the other aligned with the format for representing links in the HTTP "Link" header field. This specification also introduces a link relation type to support discovery of sets of links.</p>
<h1><a>Note to Readers</a></h1>
<p>Please discuss this draft on the "Building Blocks for HTTP APIs" mailing list (<span><</span><a href="https://www.ietf.org/mailman/listinfo/httpapi">https://www.ietf.org/mailman/listinfo/httpapi</a><span>></span>).</p>
<p>Online access to all versions and files is available on GitHub (<span><</span><a href="https://github.com/ietf-wg-httpapi/linkset">https://github.com/ietf-wg-httpapi/linkset</a><span>></span>).</p>
<h1 id="rfc.status"><a href="#rfc.status">Status of This Memo</a></h1>
<p>This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.</p>
<p>Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.</p>
<p>Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."</p>
<p>This Internet-Draft will expire on December 6, 2021.</p>
<h1 id="rfc.copyrightnotice"><a href="#rfc.copyrightnotice">Copyright Notice</a></h1>
<p>Copyright (c) 2021 IETF Trust and the persons identified as the document authors. All rights reserved.</p>
<p>This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.</p>
<hr class="noprint" />
<h1 class="np" id="rfc.toc"><a href="#rfc.toc">Table of Contents</a></h1>
<ul class="toc">
<li>1. <a href="#rfc.section.1">Introduction</a>
</li>
<li>2. <a href="#rfc.section.2">Terminology</a>
</li>
<li>3. <a href="#rfc.section.3">Scenarios</a>
</li>
<ul><li>3.1. <a href="#rfc.section.3.1">Third-Party Links</a>
</li>
<li>3.2. <a href="#rfc.section.3.2">Challenges Writing to HTTP Link Header Field</a>
</li>
<li>3.3. <a href="#rfc.section.3.3">Large Number of Links</a>
</li>
</ul><li>4. <a href="#rfc.section.4">Document Formats for Sets of Links</a>
</li>
<ul><li>4.1. <a href="#rfc.section.4.1">HTTP Link Document Format: application/linkset</a>
</li>
<li>4.2. <a href="#rfc.section.4.2">JSON Document Format: application/linkset+json</a>
</li>
<ul><li>4.2.1. <a href="#rfc.section.4.2.1">Set of Links</a>
</li>
<li>4.2.2. <a href="#rfc.section.4.2.2">Link Context Object</a>
</li>
<li>4.2.3. <a href="#rfc.section.4.2.3">Link Target Object</a>
</li>
<li>4.2.4. <a href="#rfc.section.4.2.4">Link Target Attributes</a>
</li>
<li>4.2.5. <a href="#rfc.section.4.2.5">JSON Extensibility</a>
</li>
</ul></ul><li>5. <a href="#rfc.section.5">The "profile" attribute for media types to Represent Sets of Links</a>
</li>
<li>6. <a href="#rfc.section.6">The "linkset" Relation Type for Linking to a Set of Links</a>
</li>
<li>7. <a href="#rfc.section.7">Examples</a>
</li>
<ul><li>7.1. <a href="#rfc.section.7.1">Set of Links Provided as application/linkset</a>
</li>
<li>7.2. <a href="#rfc.section.7.2">Set of Links Provided as application/linkset+json</a>
</li>
<li>7.3. <a href="#rfc.section.7.3">Discovering a Link Set via the "linkset" Link Relation Type</a>
</li>
</ul><li>8. <a href="#rfc.section.8">Implementation Status</a>
</li>
<ul><li>8.1. <a href="#rfc.section.8.1">GS1</a>
</li>
<li>8.2. <a href="#rfc.section.8.2">FAIR Signposting Profile</a>
</li>
<li>8.3. <a href="#rfc.section.8.3">Open Journal Systems (OJS)</a>
</li>
</ul><li>9. <a href="#rfc.section.9">IANA Considerations</a>
</li>
<ul><li>9.1. <a href="#rfc.section.9.1">Link Relation Type: linkset</a>
</li>
<li>9.2. <a href="#rfc.section.9.2">Media Type: application/linkset</a>
</li>
<li>9.3. <a href="#rfc.section.9.3">Media Type: application/linkset+json</a>
</li>
</ul><li>10. <a href="#rfc.section.10">Security Considerations</a>
</li>
<li>11. <a href="#rfc.references">References</a>
</li>
<ul><li>11.1. <a href="#rfc.references.1">Normative References</a>
</li>
<li>11.2. <a href="#rfc.references.2">Informative References</a>
</li>
</ul><li>Appendix A. <a href="#rfc.appendix.A">Acknowledgements</a>
</li>
<li>Appendix B. <a href="#rfc.appendix.B">JSON-LD Context</a>
</li>
<li><a href="#rfc.authors">Authors' Addresses</a>
</li>
</ul>
<h1 id="rfc.section.1">
<a href="#rfc.section.1">1.</a> <a href="#introduction" id="introduction">Introduction</a>
</h1>
<p id="rfc.section.1.p.1">Resources on the Web often use typed Web Links <a href="#RFC8288" class="xref">[RFC8288]</a>, either embedded in resource representations, for example using the <link> element for HTML documents, or conveyed in the HTTP "Link" header for documents of any media type. In some cases, however, providing links in this manner is impractical or impossible and delivering a set of links as a stand-alone document is preferable.</p>
<p id="rfc.section.1.p.2">Therefore, this specification defines two document formats and associated media types to represent sets of links. It also defines the "linkset" relation type that supports discovery of any resource that conveys a set of links as a stand-alone document.</p>
<h1 id="rfc.section.2">
<a href="#rfc.section.2">2.</a> <a href="#terminology" id="terminology">Terminology</a>
</h1>
<p id="rfc.section.2.p.1">The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 <a href="#RFC2119" class="xref">[RFC2119]</a> <a href="#RFC8174" class="xref">[RFC8174]</a> when, and only when, they appear in all capitals, as shown here.</p>
<p id="rfc.section.2.p.2">This specification uses the terms "link context" and "link target" as defined in <a href="#RFC8288" class="xref">[RFC8288]</a>. These terms respectively correspond with "Context IRI" and "Target IRI" as used in <a href="#RFC5988" class="xref">[RFC5988]</a>. Although defined as IRIs, in common scenarios they are also URIs.</p>
<p id="rfc.section.2.p.3">In the examples provided in this document, links in the HTTP "Link" header are shown on separate lines in order to improve readability. Note, however, that as per Section 3.2 of <a href="#RFC7230" class="xref">[RFC7230]</a>, line breaks are not allowed in values for HTTP headers; only whitespaces and tabs are supported as seperators. </p>
<h1 id="rfc.section.3">
<a href="#rfc.section.3">3.</a> <a href="#scenarios" id="scenarios">Scenarios</a>
</h1>
<p id="rfc.section.3.p.1">The following sections outline scenarios in which providing links by means of a standalone document instead of in an HTTP "Link" header field or as links embedded in the resource representation is advantageous or necessary.</p>
<p id="rfc.section.3.p.2">For all scenarios, links could be provided by means of a stand-alone document that is formatted according to the JSON-based serialization, the serialization aligned with the HTTP "Link" header format, or both. The former serialization is motivated by the widespread use of JSON and related tools, which suggests that handling sets of links expressed as JSON documents should be attractive to developers. The latter serialization is provided for compatibility with the existing serialization used in the HTTP "Link" header and to allow reuse of tools created to handle it.</p>
<p id="rfc.section.3.p.3">It is important to keep in mind that when providing links by means of a standalone representation, other links can still be provided using other approaches, i.e. it is possible combine various mechanisms to convey links.</p>
<h1 id="rfc.section.3.1">
<a href="#rfc.section.3.1">3.1.</a> <a href="#third-party" id="third-party">Third-Party Links</a>
</h1>
<p id="rfc.section.3.1.p.1">In some cases it is useful that links pertaining to a resource are provided by a server other than the one that hosts the resource. For example, this allows:</p>
<p></p>
<ul>
<li>Providing links in which the resource is involved not just as link context but also as link target.</li>
<li>Providing links pertaining to the resource that the server hosting that resource is not aware of.</li>
<li>External management of links pertaining to the resource in a special-purpose link management service.</li>
</ul>
<p id="rfc.section.3.1.p.3">In such cases, links pertaining to a resource can be provided by another, specific resource. That specific resource may be managed by the same or by another custodian as the resource to which the links pertain. For clients intent on consuming links provided in that manner, it would be beneficial if the following conditions were met:</p>
<p></p>
<ul>
<li>Links are provided in a document that uses a well-defined media type.</li>
<li>The resource to which the provided links pertain is able to link to the resource that provides these links using a well-known link relation type.</li>
</ul>
<p id="rfc.section.3.1.p.5">These requirements are addressed in this specification through the definition of two media types and a link relation type, respectively.</p>
<h1 id="rfc.section.3.2">
<a href="#rfc.section.3.2">3.2.</a> <a href="#header-writing" id="header-writing">Challenges Writing to HTTP Link Header Field</a>
</h1>
<p id="rfc.section.3.2.p.1">In some cases, it is not straightforward to write links to the HTTP "Link" header field from an application. This can, for example, be the case because not all required link information is available to the application or because the application does not have the capability to directly write HTTP headers. In such cases, providing links by means of a standalone document can be a solution. Making the resource that provides these links discoverable can be achieved by means of a typed link.</p>
<h1 id="rfc.section.3.3">
<a href="#rfc.section.3.3">3.3.</a> <a href="#link-volume" id="link-volume">Large Number of Links</a>
</h1>
<p id="rfc.section.3.3.p.1">When conveying links in an HTTP "Link" header field, it is possible for the size of the HTTP response header to become unpredictable. This can be the case when links are determined dynamically dependent on a range of contextual factors. It is possible to statically configure a web server to correctly handle large HTTP response headers by specifying an upper bound for their size. But when the number of links is unpredictable, estimating a reliable upper bound is challenging.</p>
<p id="rfc.section.3.3.p.2">HTTP <a href="#RFC7231" class="xref">[RFC7231]</a> defines error codes related to excess communication by the user agent ("413 Request Entity Too Large" and "414 Request-URI Too Long"), but no specific error codes are defined to indicate that response header content exceeds the upper bound that can be handled by the server, and thus it has been truncated. As a result, applications take counter measures aimed at controlling the size of the HTTP "Link" header field, for example by limiting the links they provide to those with select relation types, thereby limiting the value of the HTTP "Link" header field to clients. Providing links by means of a standalone document overcomes challenges related to the unpredictable nature of the size of HTTP "Link" header fields.</p>
<h1 id="rfc.section.4">
<a href="#rfc.section.4">4.</a> <a href="#linkset-formats" id="linkset-formats">Document Formats for Sets of Links</a>
</h1>
<p id="rfc.section.4.p.1">This section specifies two document formats to convey a set of links. Both are based on the abstract model specified in Section 2 of Web Linking <a href="#RFC8288" class="xref">[RFC8288]</a> that defines a link as consisting of a "link context", a "link relation type", a "link target", and optional "target attributes":</p>
<p></p>
<ul>
<li>The format defined in <a href="#linkset-native" class="xref">Section 4.1</a> is identical to the payload of the HTTP "Link" header field as specified in Web Linking <a href="#RFC8288" class="xref">[RFC8288]</a>.</li>
<li>The format defined in <a href="#linkset-json" class="xref">Section 4.2</a> is based on <a href="#RFC8259" class="xref">JSON</a>.</li>
</ul>
<p id="rfc.section.4.p.3">Note that <a href="#RFC8288" class="xref">[RFC8288]</a> deprecates the "rev" construct that was provided by <a href="#RFC5988" class="xref">[RFC5988]</a> as a means to express links with a directionality that is the inverse of direct links that use the "rel" construct. In both serializations for link sets defined here, inverse links SHOULD be represented as direct links using the "rel" construct and by switching the position of the resources involved in the link.</p>
<h1 id="rfc.section.4.1">
<a href="#rfc.section.4.1">4.1.</a> <a href="#linkset-native" id="linkset-native">HTTP Link Document Format: application/linkset</a>
</h1>
<p id="rfc.section.4.1.p.1">This document format is identical to the payload of the HTTP "Link" header field as defined in Section 3 of <a href="#RFC8288" class="xref">[RFC8288]</a>, more specifically by its ABNF production rule for "Link" and subsequent ones. Whereas the HTTP "Link" Header field depends on HTTP and hence on <a href="#RFC0822" class="xref">[RFC0822]</a> for its encoding, the format specified here is encoded as UTF-8 <a href="#RFC3629" class="xref">[RFC3629]</a>.</p>
<p id="rfc.section.4.1.p.2">The assigned media type for this format is "application/linkset".</p>
<p id="rfc.section.4.1.p.3">In order to support use cases where "application/linkset" documents are re-used outside the context of an HTTP interaction, it is RECOMMENDED to make them self-contained by adhering to the following guidelines:</p>
<p></p>
<ul>
<li>For every link provided in the set of links, explicitly provide the link context using the "anchor" attribute.</li>
<li>For link context ("anchor" attribute) and link target ("href" attribute), use absolute URIs (as defined in Section 4.3 of <a href="#RFC3986" class="xref">[RFC3986]</a>). </li>
</ul>
<p id="rfc.section.4.1.p.5">If these recommendations are not followed, interpretation of links in "application/linkset" documents will depend on which URI is used as context.</p>
<p id="rfc.section.4.1.p.6">It should be noted that the "application/linkset" format specified here is different than the "application/link-format" format specified in <a href="#RFC6690" class="xref">[RFC6690]</a> in that the former fully matches the payload of the HTTP "Link" header as defined in Section 3 of <a href="#RFC8288" class="xref">[RFC8288]</a>, whereas the latter introduces constraints on that definition to meet requirements for Constrained RESTful Environments.</p>
<h1 id="rfc.section.4.2">
<a href="#rfc.section.4.2">4.2.</a> <a href="#linkset-json" id="linkset-json">JSON Document Format: application/linkset+json</a>
</h1>
<p id="rfc.section.4.2.p.1">This document format uses JSON <a href="#RFC8259" class="xref">[RFC8259]</a> as the syntax to represent a set of links. The set of links follows the abstract model defined by Web Linking <a href="#RFC8288" class="xref">[RFC8288]</a>.</p>
<p id="rfc.section.4.2.p.2">The assigned media type for this format is "application/linkset+json".</p>
<p id="rfc.section.4.2.p.3">In order to support use cases where "application/linkset+json" documents are re-used outside the context of an HTTP interaction, it is RECOMMENDED to make them self-contained by adhering to the following guidelines:</p>
<p></p>
<ul>
<li>For every link provided in the set of links, explicitly provide the link context using the "anchor" member.</li>
<li>For link context ("anchor" member) and link target ("href" member), use absolute URIs (as defined in Section 4.3 of <a href="#RFC3986" class="xref">[RFC3986]</a>).</li>
</ul>
<p id="rfc.section.4.2.p.5">If these recommendations are not followed, interpretation of "application/linkset+json" will depend on which URI is used as context URI.</p>
<p id="rfc.section.4.2.p.6">The "application/linkset+json" serialization is designed such that it can directly be used as the content of a JSON-LD serialization by adding an appropriate context. <a href="#appendix-1" class="xref">Appendix B</a> shows an example of a possible context that, when added to a JSON serialization, allows it to be interpreted as RDF.</p>
<h1 id="rfc.section.4.2.1">
<a href="#rfc.section.4.2.1">4.2.1.</a> <a href="#linkset-in-json" id="linkset-in-json">Set of Links</a>
</h1>
<p id="rfc.section.4.2.1.p.1">In the JSON representation of a set of links:</p>
<p></p>
<ul>
<li>A set of links MUST be represented as a JSON object which MUST have "linkset" as its sole member.</li>
<li>The "linkset" member is an array in which a distinct JSON object - the "link context object" (see <a href="#linkset-json-link-context-object" class="xref">Section 4.2.2</a>) - MUST be used to represent links that have the same link context.</li>
<li>If necessary, the "linkset" member MAY contain information in addition to link context objects, in which case that information MUST NOT change the semantics of the links provided by those link context objects.</li>
<li>Even if there is only one link context object, it MUST be wrapped in an array. Members other than link context objects MUST NOT be included in this array.</li>
</ul>
<h1 id="rfc.section.4.2.2">
<a href="#rfc.section.4.2.2">4.2.2.</a> <a href="#linkset-json-link-context-object" id="linkset-json-link-context-object">Link Context Object</a>
</h1>
<p id="rfc.section.4.2.2.p.1">In the JSON representation one or more links that have the same link context are represented by a JSON object, the link context object. A link context object adheres to the following rules:</p>
<p></p>
<ul>
<li>Each link context object MAY have an "anchor" member with a value that represents the link context. If present, this value SHOULD be an absolute URI as defined in Section 4.3 of <a href="#RFC3986" class="xref">[RFC3986]</a>. Cases where the anchor member is present, but no value is provided for it (i.e. the resource providing the set of links is the link context for each link in the link context object) MUST be handled by providing an "anchor" member with empty string ("anchor": "").</li>
<li>For each distinct relation type that the link context has with link targets, a link context object MUST have an additional member. This member is an array in which a distinct JSON object - the "link target object" (see <a href="#linkset-json-link-target-object" class="xref">Section 4.2.3</a>) - MUST be used for each link target for which the relationship with the link context (value of the encompassing anchor member) applies. The name of this member expresses the relation type of the link as follows:</li>
<li><ul>
<li>For registered relation types <a href="#RFC8288" class="xref">[RFC8288]</a>, the name of this member is the registered name of the relation type.</li>
<li>For extension relation types <a href="#RFC8288" class="xref">[RFC8288]</a>, the name of this member is the URI that uniquely represents the relation type.</li>
</ul></li>
<li>Even if there is only one link target object it MUST be wrapped in an array. Members other than link target objects MUST NOT be included in this array.</li>
</ul>
<h1 id="rfc.section.4.2.3">
<a href="#rfc.section.4.2.3">4.2.3.</a> <a href="#linkset-json-link-target-object" id="linkset-json-link-target-object">Link Target Object</a>
</h1>
<p id="rfc.section.4.2.3.p.1">In the JSON representation a link target is represented by a JSON object, the link target object. A link target object adheres to the following rules:</p>
<p></p>
<ul>
<li>Each link target object MUST have an "href" member with a value that represents the link target. This value SHOULD be an absolute URI as defined in Section 4.3 of <a href="#RFC3986" class="xref">[RFC3986]</a>. Cases where the href member is present, but no value is provided for it (i.e. the resource providing the set of links is the target of the link in the link target object) MUST be handled by providing an "href" member with an empty string ("href": "").</li>
<li>In many cases, a link target is further qualified by target attributes. Various types of attributes exist and they are conveyed as additional members of the link target object as detailed in <a href="#json-target-attributes" class="xref">Section 4.2.4</a>.</li>
</ul>
<p id="rfc.section.4.2.3.p.3">The following example of a JSON-serialized set of links represents one link with its core components: link context, link relation type, and link target.</p>
<pre>
{
"linkset":
[
{ "anchor": "http://example.net/bar",
"next": [
{"href": "http://example.com/foo"}
]
}
]
}
</pre>
<p id="rfc.section.4.2.3.p.4">The following example of a JSON-serialized set of links represents two links that share link context and relation type but have different link targets. </p>
<pre>
{
"linkset":
[
{ "anchor": "http://example.net/bar",
"item": [
{"href": "http://example.com/foo1"},
{"href": "http://example.com/foo2"}
]
}
]
}
</pre>
<p id="rfc.section.4.2.3.p.5">The following example shows a set of links that represents two links, each with a different link context, link target, and relation type. One relation type is registered, the other is an extension relation type.</p>
<pre>
{
"linkset":
[
{ "anchor": "http://example.net/bar",
"next": [
{"href": "http://example.com/foo1"}
]
},
{ "anchor": "http://example.net/boo",
"http://example.com/relations/baz" : [
{"href": "http://example.com/foo2"}
]
}
]
}
</pre>
<h1 id="rfc.section.4.2.4">
<a href="#rfc.section.4.2.4">4.2.4.</a> <a href="#json-target-attributes" id="json-target-attributes">Link Target Attributes</a>
</h1>
<p id="rfc.section.4.2.4.p.1">A link may be further qualified by target attributes. Three types of attributes exist:</p>
<p></p>
<ul>
<li>Attributes defined by the serialization of <a href="#RFC8288" class="xref">Web Linking</a>.</li>
<li>Extension attributes defined and used by communities as allowed by <a href="#RFC8288" class="xref">[RFC8288]</a>.</li>
<li>Internationalized versions of the "title" attribute defined by <a href="#RFC8288" class="xref">[RFC8288]</a> and of extension attributes allowed by <a href="#RFC8288" class="xref">[RFC8288]</a>.</li>
</ul>
<p id="rfc.section.4.2.4.p.3">The handling of these different types of attributes is described in the sections below.</p>
<h1 id="rfc.section.4.2.4.1">
<a href="#rfc.section.4.2.4.1">4.2.4.1.</a> <a href="#json-target-attributes-existing" id="json-target-attributes-existing">Target Attributes Defined by Web Linking</a>
</h1>
<p id="rfc.section.4.2.4.1.p.1">RFC 8288 defines the following target attributes that may be used to annotate links: "hreflang", "media", "title", "title*", and "type"; these target attributes follow different occurrence and value patterns. In the JSON representation, these attributes MUST be conveyed as additional members of the link target object as follows:</p>
<p></p>
<ul>
<li>"hreflang": The optional and repeatable "hreflang" target attribute MUST be represented by an array (even if there only is one value to be represented), and each value in that array MUST be a string - representing one value of the "hreflang" target attribute for a link - which follows the same model as in the <a href="#RFC8288" class="xref">[RFC8288]</a> syntax.</li>
<li>"media": The optional and not repeatable "media" target attribute MUST be represented by a "media" member in the link target object, and its value MUST be a string that follows the same model as in the <a href="#RFC8288" class="xref">[RFC8288]</a> syntax.</li>
<li>"type": The optional and not repeatable "type" target attribute MUST be represented by a "type" member in the link target object, and its value MUST be a string that follows the same model as in the <a href="#RFC8288" class="xref">[RFC8288]</a> syntax.</li>
<li>"title": The optional and not repeatable "title" target attribute MUST be represented by a "title" member in the link target object, and its value MUST be a string that follows the same model as in the <a href="#RFC8288" class="xref">[RFC8288]</a> syntax.</li>
<li>"title*": The optional and not repeatable "title*" target attribute is motivated by character encoding and language issues and follows the model defined in <a href="#RFC8187" class="xref">[RFC8187]</a>. The details of the JSON representation that applies to title* are described in <a href="#linkset-json-i18n-link-parameter" class="xref">Section 4.2.4.2</a>. </li>
</ul>
<p id="rfc.section.4.2.4.1.p.3">The following example illustrates how the repeatable "hreflang" and the not repeatable "type" target attributes are represented in a link target object.</p>
<pre>
{
"linkset":
[
{ "anchor": "http://example.net/bar",
"next": [
{"href": "http://example.com/foo",
"type": "text/html",
"hreflang": [ "en" , "de" ]
}
]
}
]
}
</pre>
<h1 id="rfc.section.4.2.4.2">
<a href="#rfc.section.4.2.4.2">4.2.4.2.</a> <a href="#linkset-json-i18n-link-parameter" id="linkset-json-i18n-link-parameter">Internationalized Target Attributes</a>
</h1>
<p id="rfc.section.4.2.4.2.p.1">In addition to the target attributes described in <a href="#json-target-attributes-existing" class="xref">Section 4.2.4.1</a>, <a href="#RFC8288" class="xref">[RFC8288]</a> also supports attributes that follow the content model of <a href="#RFC8187" class="xref">[RFC8187]</a>. In <a href="#RFC8288" class="xref">[RFC8288]</a>, these target attributes are recognizable by the use of a trailing asterisk in the attribute name, such as "title*". The content model of <a href="#RFC8187" class="xref">[RFC8187]</a> uses a string-based microsyntax that represents the character encoding, an optional language tag, and the escaped attribute value encoded according to the specified character encoding.</p>
<p id="rfc.section.4.2.4.2.p.2">The JSON serialization for these target attributes MUST be as follows:</p>
<p></p>
<ul>
<li>An internationalized target attribute is represented as a member of the link context object with the same name (including the *) of the attribute.</li>
<li>The character encoding information as prescribed by <a href="#RFC8187" class="xref">[RFC8187]</a> is not preserved; instead, the content of the internationalized attribute is represented in the character encoding used for the JSON set of links.</li>
<li>The value of the internationalized target attribute is an array that contains one or more JSON objects. The name of one member of such JSON object is "value" and its value is the actual content (in its unescaped version) of the internationalized target attribute, i.e. the value of the attribute from which the encoding and language information are removed. The name of another, optional, member of such JSON object is "language" and its value is the language tag <a href="#RFC5646" class="xref">[RFC5646]</a> for the language in which the attribute content is conveyed. </li>
</ul>
<p id="rfc.section.4.2.4.2.p.4">The following example illustrates how the "title*" target attribute defined by <a href="#RFC8288" class="xref">[RFC8288]</a> is represented in a link target object.</p>
<pre>
{
"linkset":
[
{ "anchor": "http://example.net/bar",
"next": [
{"href": "http://example.com/foo",
"type": "text/html",
"hreflang": [ "en" , "de" ],
"title": "Next chapter",
"title*": [ { "value": "nachstes Kapitel" ,
"language" : "de" } ]
}
]
}
]
}
</pre>
<p id="rfc.section.4.2.4.2.p.5">The above example assumes that the German title contains an umlaut character (in the native syntax it would be encoded as title*=UTF-8'de'n%c3%a4chstes%20Kapitel), which gets encoded in its unescaped form in the JSON representation. This is not shown in the above example due to the limitations of RFC publication. Implementations MUST properly decode/encode internationalized target attributes that follow the model of <a href="#RFC8187" class="xref">[RFC8187]</a> when transcoding between the "application/linkset" and the "application/linkset+json" formats.</p>
<h1 id="rfc.section.4.2.4.3">
<a href="#rfc.section.4.2.4.3">4.2.4.3.</a> <a href="#json-target-attributes-extension" id="json-target-attributes-extension">Extension Target Attributes</a>
</h1>
<p id="rfc.section.4.2.4.3.p.1">Extension target attributes are attributes that are not defined by <a href="#RFC8288" class="xref">[RFC8288]</a> (as listed in <a href="#json-target-attributes-existing" class="xref">Section 4.2.4.1</a>), but are nevertheless used to qualify links. They can be defined by communities in any way deemed necessary, and it is up to them to make sure their usage is understood by target applications. However, lacking standardization, there is no interoperable understanding of these extension attributes. One important consequence is that their cardinality is unknown to generic applications. Therefore, in the JSON serialization, all extension target attributes are treated as repeatable.</p>
<p id="rfc.section.4.2.4.3.p.2">The JSON serialization for these target attributes MUST be as follows:</p>
<p></p>
<ul>
<li>An extension target attribute is represented as a member of the link context object with the same name of the attribute, including the * if applicable.</li>
<li>The value of an extension attribute MUST be represented by an array, even if there only is one value to be represented.</li>
<li>If the extension target attribute does not have a name with a trailing asterisk, then each value in that array MUST be a string that represents one value of the attribute.</li>
<li>If the extension attribute has a name with a trailing asterisk (it follows the content model of <a href="#RFC8187" class="xref">[RFC8187]</a>), then each value in that array MUST be a JSON object. The value of each such JSON object MUST be structured as described in <a href="#linkset-json-i18n-link-parameter" class="xref">Section 4.2.4.2</a>.</li>
</ul>
<p id="rfc.section.4.2.4.3.p.4">The example shows a link target object with three extension target attributes. The value for each extension target attribute is an array. The two first are regular extension target attributes, with the first one ("foo") having only one value and the second one ("bar") having two. The last extension target attribute ("baz*") follows the naming rule of <a href="#RFC8187" class="xref">[RFC8187]</a> and therefore is encoded according to the serialization described in <a href="#linkset-json-i18n-link-parameter" class="xref">Section 4.2.4.2</a>. </p>
<pre>
{
"linkset":
[
{ "anchor": "http://example.net/bar",
"next": [
{ "href": "http://example.com/foo",
"type": "text/html",
"foo": [ "foovalue" ],
"bar": [ "barone", "bartwo" ],
"baz*": [ { "value": "bazvalue" ,
"language" : "en" } ]
}
]
}
]
}
</pre>
<h1 id="rfc.section.4.2.5">
<a href="#rfc.section.4.2.5">4.2.5.</a> <a href="#json-extensibility" id="json-extensibility">JSON Extensibility</a>
</h1>
<p id="rfc.section.4.2.5.p.1">The extensibility of the JSON document format for representing a set of links is restricted to the extensibility provided by <a href="#RFC8288" class="xref">[RFC8288]</a>. The Web linking model provides for the use of extension target attributes as discussed in <a href="#json-target-attributes-extension" class="xref">Section 4.2.4.3</a>. Extensions based on the JSON syntax MUST NOT be used, and MUST be ignored when found in a JSON linkset document.</p>
<p id="rfc.section.4.2.5.p.2">This limitation of the JSON format allows to unambiguously round trip between links provided in the HTTP "Link" header, sets of links serialized according to the "application/linkset" format, and sets of links serialized according to the "application/linkset+json" format.</p>
<h1 id="rfc.section.5">
<a href="#rfc.section.5">5.</a> <a href="#profile-attribute" id="profile-attribute">The "profile" attribute for media types to Represent Sets of Links</a>
</h1>
<p id="rfc.section.5.p.1">As a means to convey specific constraints or conventions (as per <a href="#RFC6906" class="xref">[RFC6906]</a>) that apply to a link set document, the "profile" attribute MAY be used in conjunction with the media types "application/linkset" and "application/linkset+json" detailed in <a href="#linkset-native" class="xref">Section 4.1</a> and <a href="#linkset-json" class="xref">Section 4.2</a>, respectively. For example, the attribute could be used to indicate that a link set uses a specific, limited set of link relation types.</p>
<p id="rfc.section.5.p.2">The value of the "profile" attribute MUST be a non-empty list of space-separated URIs, each of which identifies specific constraints or conventions that apply to the link set document. Profile URIs MAY be registered in the IANA Profile URI Registry in the manner specified by <a href="#RFC7284" class="xref">[RFC7284]</a>.</p>
<p id="rfc.section.5.p.3">The presence of a "profile" attribute in conjunction with the "application/linkset" and "application/linkset+json" media types does not change the semantics of a link set. As such, clients with and without knowledge of profile URIs can use the same representation. The profile parameter MAY be used by clients to express their preferences, and, if a client does so, a server SHOULD return a document that honors the profiles it recognizes, and MUST ignore the profiles which it does not recognize.</p>
<h1 id="rfc.section.6">
<a href="#rfc.section.6">6.</a> <a href="#linkset-link-relation" id="linkset-link-relation">The "linkset" Relation Type for Linking to a Set of Links</a>
</h1>
<p id="rfc.section.6.p.1">The target of a link with the "linkset" relation type provides a set of links, including links in which the resource that is the link context participates.</p>
<p id="rfc.section.6.p.2">A link with the "linkset" relation type MAY be provided in the header and/or the body of a resource's representation. It may also be discovered by other means, such as through client-side information.</p>
<p id="rfc.section.6.p.3">A resource MAY provide more than one link with a "linkset" relation type. Multiple such links can refer to the same set of links expressed using different media types, or to different sets of links, potentially provided by different third-party services.</p>
<p id="rfc.section.6.p.4">A user agent that follows a "linkset" link MUST be aware that the set of links provided by the resource that is the target of the link can contain links in which the resource that is the context of the link does not participate; it MAY decide to ignore those links.</p>
<p id="rfc.section.6.p.5">A user agent that follows a "linkset" link and obtains links for which anchors and targets are not expressed as absolute URIs MUST properly determine what the context is for these links; it SHOULD ignore links for which it is unable to unambiguously make that determination.</p>
<h1 id="rfc.section.7">
<a href="#rfc.section.7">7.</a> <a href="#linkset-link-examples" id="linkset-link-examples">Examples</a>
</h1>
<p><a href="#linkset-link-link-format" class="xref">Section 7.1</a> and <a href="#linkset-link-json-format" class="xref">Section 7.2</a> show examples whereby a set of links is provided as "application/linkset" and "application/linkset+json" documents, respectively. <a href="#linkset-rel-example" class="xref">Section 7.3</a> illustrates the use of the "linkset" link relation type to support discovery of sets of links. </p>
<h1 id="rfc.section.7.1">
<a href="#rfc.section.7.1">7.1.</a> <a href="#linkset-link-link-format" id="linkset-link-link-format">Set of Links Provided as application/linkset</a>
</h1>
<p><a href="#Request1" class="xref">Figure 1</a> shows a client issuing an HTTP GET request against resource <https://example.org/links/resource1>.</p>
<div id="rfc.figure.1"></div>
<div id="Request1"></div>
<pre>
GET /links/resource1 HTTP/1.1
Host: example.org
Connection: close
</pre>
<p class="figure">Figure 1: Client HTTP GET request</p>
<p><a href="#Response1.1" class="xref">Figure 2</a> shows the response to the GET request of <a href="#Request1" class="xref">Figure 1</a>. The response contains a Content-Type header specifying that the media type of the response is "application/linkset". A set of links, revealing authorship and versioning related to resource <https://example.org/resource1>, is provided in the response body. The HTTP "Link" header indicates the availability of an alternate representation of the set of links using media type "application/linkset+json". </p>
<div id="rfc.figure.2"></div>
<div id="Response1.1"></div>
<pre>
HTTP/1.1 200 OK
Date: Mon, 12 Aug 2019 10:35:51 GMT
Server: Apache-Coyote/1.1
Content-Length: 1023
Content-Type: application/linkset; charset=UTF-8
Link: <https://example.org/links/resource1> ; rel="alternate"
; type="application/linkset+json"
Connection: close
<https://authors.example.net/johndoe>
; rel="author"
; type="application/rdf+xml"
; anchor="https://example.org/resource1",
<https://example.org/resource1?version=3>
; rel="latest-version"
; type="text/html"
; anchor="https://example.org/resource1",
<https://example.org/resource1?version=2>
; rel="predecessor-version"
; type="text/html"
; anchor="https://example.org/resource1?version=3",
<https://example.org/resource1?version=1>
; rel="predecessor-version"
; type="text/html"
; anchor="https://example.org/resource1?version=2",
<https://example.org/resource1?version=1>
; rel="memento"
; type="text/html"
; datetime="Thu, 13 Jun 2019 09:34:33 GMT"
; anchor="https://example.org/resource1",
<https://example.org/resource1?version=2>
; rel="memento"
; type="text/html"
; datetime="Sun, 21 Jul 2019 12:22:04 GMT"
; anchor="https://example.org/resource1",
<https://authors.example.net/alice>
; rel="author"
; anchor="https://example.org/resource1#comment=1"
</pre>
<p class="figure">Figure 2: Response to HTTP GET includes a set of links</p>
<h1 id="rfc.section.7.2">
<a href="#rfc.section.7.2">7.2.</a> <a href="#linkset-link-json-format" id="linkset-link-json-format">Set of Links Provided as application/linkset+json</a>
</h1>
<p><a href="#Request4" class="xref">Figure 3</a> shows the client issuing an HTTP GET request against <https://example.org/links/resource1>. In the request, the client uses an "Accept" header to indicate it prefers a response in the "application/linkset+json" format. </p>
<div id="rfc.figure.3"></div>
<div id="Request4"></div>
<pre>
GET links/resource1 HTTP/1.1
Host: example.org
Accept: application/linkset+json
Connection: close
</pre>
<p class="figure">Figure 3: Client HTTP GET request expressing preference for "application/linkset+json" response</p>
<p><a href="#Response4.1" class="xref">Figure 4</a> shows the response to the HTTP GET request of <a href="#Request4" class="xref">Figure 3</a>. The set of links is serialized according to the media type "application/linkset+json". </p>
<div id="rfc.figure.4"></div>
<div id="Response4.1"></div>
<pre>
HTTP/1.1 200 OK
Date: Mon, 12 Aug 2019 10:46:22 GMT
Server: Apache-Coyote/1.1
Content-Type: application/linkset+json
Link: <https://example.org/links/resource1> ; rel="alternate"
; type="application/linkset"
Content-Length: 1349
{
"linkset": [
{
"anchor": "https://example.org/resource1",
"author": [
{
"href": "https://authors.example.net/johndoe",
"type": "application/rdf+xml"
}
],
"memento": [
{
"href": "https://example.org/resource1?version=1",
"type": "text/html",
"datetime": "Thu, 13 Jun 2019 09:34:33 GMT"
},
{
"href": "https://example.org/resource1?version=2",
"type": "text/html",
"datetime": "Sun, 21 Jul 2019 12:22:04 GMT"
}
],
"latest-version": [
{
"href": "https://example.org/resource1?version=3",
"type": "text/html"
}
]
},
{
"anchor": "https://example.org/resource1?version=3",
"predecessor-version": [
{
"href": "https://example.org/resource1?version=2",
"type": "text/html"
}
]
},
{
"anchor": "https://example.org/resource1?version=2",
"predecessor-version": [
{
"href": "https://example.org/resource1?version=1",
"type": "text/html"
}
]
},
{
"anchor": "https://example.org/resource1#comment=1",
"author": [
{
"href": "https://authors.example.net/alice"
}
]
}
]
}
</pre>
<p class="figure">Figure 4: Response to the client's request for the set of links</p>
<h1 id="rfc.section.7.3">
<a href="#rfc.section.7.3">7.3.</a> <a href="#linkset-rel-example" id="linkset-rel-example">Discovering a Link Set via the "linkset" Link Relation Type</a>
</h1>
<p><a href="#Request3" class="xref">Figure 5</a> shows a client issuing an HTTP HEAD request against resource <https://example.org/resource1>.</p>
<div id="rfc.figure.5"></div>
<div id="Request3"></div>
<pre>
HEAD resource1 HTTP/1.1
Host: example.org
Connection: close
</pre>
<p class="figure">Figure 5: Client HTTP HEAD request</p>
<p><a href="#Response3.1" class="xref">Figure 6</a> shows the response to the HEAD request of <a href="#Request3" class="xref">Figure 5</a>. The response contains an HTTP "Link" header with a link that has the "linkset" relation type. It indicates that a set of links is provided by resource <https://example.org/links/resource1>, which provides a representation with media type "application/linkset+json". </p>
<div id="rfc.figure.6"></div>