/
2012-12-13-link-types.html
33 lines (26 loc) · 1.49 KB
/
2012-12-13-link-types.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
---
layout: recipe
title: Using link-types in relations
category: Resources
author: joshua thijssen
author_email: jthijssen@noxlogic.nl
---
<h2 class="question">How does a client know what to do when encountering a link-type inside a rel-tag?</h2>
<p>Using links is the most important part of HATEOAS. With links, clients can discover the possibilities and actions that
can take place in your API. However, clients should know what a specific link does. This can be found through the
relation-type, which is stored in the "rel"-attributes.</p>
{% highlight xml %}
<link rel="comments" type="application/x.atom+xml" title="Blog comments" href="http://.."/>
{% endhighlight %}
<p>There are specific relation types that are predefined. If you use one of these relation-types inside your own API, you
MUST make sure they behave as expected, otherwise this might confuse your clients. See below for a link to these
relation-types.</p>
<p>If you use non-standard relation types, they are required to be URIs. You can help clients understand what your custom
link relation types do by making the URI de-referenceable, and place the documentation for that relation at that URI.
</p>
<h3>See also</h3>
<ul>
<li><a href="http://www.iana.org/assignments/link-relations/link-relations.xml">IANA - Link relation</a></li>
<li><a href="http://www.w3.org/TR/html5/links.html">HTML5 Specification - Links</a></li>
<li><a href="http://tools.ietf.org/html/rfc5988">RFC 5988: Web Linking</a></li>
</ul>