<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.1.2 -->

<!DOCTYPE rfc SYSTEM "../Tools/rfc2629xslt/rfc2629.dtd" [
]>

<?rfc toc="yes"?>
<?rfc tocindent="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc rfcedstyle="yes"?>

<rfc ipr="trust200902" docName="draft-nottingham-link-template-02" category="std">

  <front>
    <title abbrev="Link-Template">The Link-Template HTTP Header Field</title>

    <author initials="M." surname="Nottingham" fullname="Mark Nottingham">
      <organization></organization>
      <address>
        <email>mnot@mnot.net</email>
        <uri>https://www.mnot.net/</uri>
      </address>
    </author>

    <date year="2017"/>

    <area>General</area>
    
    <keyword>link relation</keyword>

    <abstract>


<t>This specification defines the Link-Template HTTP header field, providing a means for describing
the structure of a link between two resources, so that new links can be generated.</t>



    </abstract>


    <note title="Note to Readers">


<t>The issues list can be found at <eref target="https://github.com/mnot/I-D/labels/link-template">https://github.com/mnot/I-D/labels/link-template</eref>.</t>

<t>The most recent (often, unpublished) draft is at <eref target="https://mnot.github.io/I-D/link-template/">https://mnot.github.io/I-D/link-template/</eref>.</t>

<t>Recent changes are listed at <eref target="https://github.com/mnot/I-D/commits/gh-pages/link-template">https://github.com/mnot/I-D/commits/gh-pages/link-template</eref>.</t>


    </note>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t><xref target="RFC6570"/> defines a syntax for templates that, when expanded using a set of variables, results
in a URI <xref target="RFC3986"/>.</t>

<t>This specification defines a HTTP header field for conveying templates for links in the headers of
a HTTP message. It is complimentary to the Link header field <xref target="RFC5988"/>, which carries links
directly.</t>

<section anchor="notational-conventions" title="Notational Conventions">

<t>The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”,
“RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in <xref target="RFC2119"/>.</t>

<t>This document uses the Augmented BNF defined in <xref target="RFC7230"/> to specify valid protocol
elements. Additionally, it uses the modified “parameter” rule from <xref target="RFC5987"/>,
and the “URI-Template” rule from <xref target="RFC6570"/>.</t>

</section>
</section>
<section anchor="the-link-template-header-field" title="The Link-Template Header Field">

<t>The Link-Template entity-header field provides a means for serialising one or more links into HTTP
headers. It is semantically equivalent to the Link header field <xref target="RFC5988"/>, except
that it uses URI Templates <xref target="RFC6570"/> to convey the structure of links.</t>

<figure><artwork><![CDATA[
  Link-Template  = "Link-Template" ":" #linkt-value
  linkt-value    = "<" URI-Template ">" *( ";" parameter )
]]></artwork></figure>

<t>For example:</t>

<figure><artwork><![CDATA[
Link-Template: </{username}>; rel="http://example.org/rel/user"
]]></artwork></figure>

<t>indicates that a resource with the relation type “http://example.org/rel/user” can be found by
interpolating the “username” variable into the template given.</t>

<t>The target for the link (as defined by <xref target="RFC5988"/>) is the result of expanding the URI
Template <xref target="RFC6570"/> (being converted to an absolute URI after expansion, if
necessary).</t>

<t>The context, relation type and target attributes for the link are determined as defined for the
Link header field in <xref target="RFC5988"/>.</t>

<t>The parameters on a linkt-value have identical semantics to those of a Link header field
<xref target="RFC5988"/>. This includes (but is not limited to) the use of the “rel” parameter to convey the
relation type, the “anchor” parameter to modify the context IRI, and so on.</t>

<t>Likewise, the requirements for parameters on linkt-values are the same as those for a Link header
field; in particular, the “rel” parameter MUST NOT appear more than once, and if it does, the
linkt-value MUST be ignored by parsers.</t>

<t>This specification defines additional semantics for the “var-base” parameter on linkt-values; see
below.</t>

<section anchor="the-var-base-parameter" title="The ‘var-base’ parameter">

<t>When a linkt-value has a ‘var-base’ parameter, its value conveys a URI-reference that is used as a
base URI for the variable names in the URI template.</t>

<t>This mechanism allows template variables to be globally identified, rather than specific to the
context of use. Dereferencing the URI for a particular variable might lead to more information
about the syntax or semantics of that variable; specification of particular formats for this
information is out of scope for this document.</t>

<t>To determine the URI for a given variable, the value given is used as a base URI in reference
resolution (as specified in <xref target="RFC3986"/>). If the resulting URI is still relative, the
context of the link is used as the base URI in a further resolution; see <xref target="RFC5988"/>.</t>

<t>For example:</t>

<figure><artwork><![CDATA[
Link-Template: </widgets/{widget_id}>;
               rel="http://example.org/rel/widget";
               var-base="http://example.org/vars/"
]]></artwork></figure>

<t>indicates that a resource with the relation type “http://example.org/rel/widget” can be found by
interpolating the “http://example.org/vars/widget_id” variable into the template given.</t>

<t>If the current context of the message that the header appears within is “http://example.org/”, the
same information could be conveyed by this header field:</t>

<figure><artwork><![CDATA[
Link-Template: </widgets/{widget_id}>;
               rel="http://example.org/rel/widget";
               var-base="/vars/"
]]></artwork></figure>

</section>
</section>
<section anchor="security-considerations" title="Security Considerations">

<t>The security consideration for the Link header field in <xref target="RFC5988"/> and those for URI Templates
<xref target="RFC6570"/> both apply.</t>

</section>
<section anchor="iana-considerations" title="IANA Considerations">

<t>This specification enters the “Link-Template” into the registry of Permanent Message Header Field
Names.</t>

<figure><artwork><![CDATA[
Header Field Name: Link-Template
Protocol: http
Status:
Reference: [this document]
]]></artwork></figure>

</section>


  </middle>

  <back>

    <references title='Normative References'>





<reference  anchor="RFC6570" target='http://www.rfc-editor.org/info/rfc6570'>
<front>
<title>URI Template</title>
<author initials='J.' surname='Gregorio' fullname='J. Gregorio'><organization /></author>
<author initials='R.' surname='Fielding' fullname='R. Fielding'><organization /></author>
<author initials='M.' surname='Hadley' fullname='M. Hadley'><organization /></author>
<author initials='M.' surname='Nottingham' fullname='M. Nottingham'><organization /></author>
<author initials='D.' surname='Orchard' fullname='D. Orchard'><organization /></author>
<date year='2012' month='March' />
<abstract><t>A URI Template is a compact sequence of characters for describing a range of Uniform Resource Identifiers through variable expansion. This specification defines the URI Template syntax and the process for expanding a URI Template into a URI reference, along with guidelines for the use of URI Templates on the Internet.   [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='6570'/>
<seriesInfo name='DOI' value='10.17487/RFC6570'/>
</reference>



<reference  anchor="RFC3986" target='http://www.rfc-editor.org/info/rfc3986'>
<front>
<title>Uniform Resource Identifier (URI): Generic Syntax</title>
<author initials='T.' surname='Berners-Lee' fullname='T. Berners-Lee'><organization /></author>
<author initials='R.' surname='Fielding' fullname='R. Fielding'><organization /></author>
<author initials='L.' surname='Masinter' fullname='L. Masinter'><organization /></author>
<date year='2005' month='January' />
<abstract><t>A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource.  This specification defines the generic URI syntax and a process for resolving URI references that might be in relative form, along with guidelines and security considerations for the use of URIs on the Internet.  The URI syntax defines a grammar that is a superset of all valid URIs, allowing an implementation to parse the common components of a URI reference without knowing the scheme-specific requirements of every possible identifier.  This specification does not define a generative grammar for URIs; that task is performed by the individual specifications of each URI scheme.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='STD' value='66'/>
<seriesInfo name='RFC' value='3986'/>
<seriesInfo name='DOI' value='10.17487/RFC3986'/>
</reference>



<reference  anchor="RFC5988" target='http://www.rfc-editor.org/info/rfc5988'>
<front>
<title>Web Linking</title>
<author initials='M.' surname='Nottingham' fullname='M. Nottingham'><organization /></author>
<date year='2010' month='October' />
<abstract><t>This document specifies relation types for Web links, and defines a registry for them.  It also defines the use of such links in HTTP headers with the Link header field.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='5988'/>
<seriesInfo name='DOI' value='10.17487/RFC5988'/>
</reference>



<reference  anchor="RFC2119" target='http://www.rfc-editor.org/info/rfc2119'>
<front>
<title>Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials='S.' surname='Bradner' fullname='S. Bradner'><organization /></author>
<date year='1997' month='March' />
<abstract><t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract>
</front>
<seriesInfo name='BCP' value='14'/>
<seriesInfo name='RFC' value='2119'/>
<seriesInfo name='DOI' value='10.17487/RFC2119'/>
</reference>



<reference  anchor="RFC7230" target='http://www.rfc-editor.org/info/rfc7230'>
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding' role='editor'><organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke' role='editor'><organization /></author>
<date year='2014' month='June' />
<abstract><t>The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems.  This document provides an overview of HTTP architecture and its associated terminology, defines the &quot;http&quot; and &quot;https&quot; Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations.</t></abstract>
</front>
<seriesInfo name='RFC' value='7230'/>
<seriesInfo name='DOI' value='10.17487/RFC7230'/>
</reference>



<reference  anchor="RFC5987" target='http://www.rfc-editor.org/info/rfc5987'>
<front>
<title>Character Set and Language Encoding for Hypertext Transfer Protocol (HTTP) Header Field Parameters</title>
<author initials='J.' surname='Reschke' fullname='J. Reschke'><organization /></author>
<date year='2010' month='August' />
<abstract><t>By default, message header field parameters in Hypertext Transfer Protocol (HTTP) messages cannot carry characters outside the ISO- 8859-1 character set.  RFC 2231 defines an encoding mechanism for use in Multipurpose Internet Mail Extensions (MIME) headers.  This document specifies an encoding suitable for use in HTTP header fields that is compatible with a profile of the encoding defined in RFC 2231.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='5987'/>
<seriesInfo name='DOI' value='10.17487/RFC5987'/>
</reference>




    </references>




  </back>

<!-- ##markdown-source:
H4sIAGMzR1kAA8VYbW/bOBL+zl8xp3zY5uCXNIvdtk63uFzTXgPkpZukWBwO
i4KSaJuIJPpIKo6vSH/7PkNKshTnuv1wwOWDI4uc4bw888zQ4/FYeO0LNaOb
paIzXd2Ob1S5KqRX9OHm5iN9UDJXlt5rVeRCpql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