Appearance
Common Relations
These link relations are shared between the Payments API and the Insurance API. They are emitted with their IANA registry semantics — clients can treat them the way they would in any HTTP API.
| Relation | Description |
|---|---|
self | The URL of the current resource. self links can be considered ad-hoc entry points into the API and can be safely stored for future visits to the resource in the representation of which the link was encountered. |
first | First item (page) of the underlying collection. Emitted by resources advertising the item profile. |
prev | Previous item (page), relative to the current one. Emitted by resources advertising the item profile. |
next | Next item (page), relative to the current one. Emitted by resources advertising the item profile. |
last | Last item (page) of the underlying collection. Emitted by resources advertising the item profile. |
payment | A resource where payment is accepted. Emitted by representations of the payment-experience profile (Payments API) and the intermediated-insurance-application profile (Insurance API). Share the href with your client so they can complete payment in the prepared experience. |
monitor | External tracking page for a payment. Opens in a browser (different host); not intended for server-to-server traversal. |
icon | Icon image for a resource (for example, an insurance provider logo). |
terms-of-service | Terms and conditions document for a product. |
preview | A preview representation of the target resource. |
Not exhaustive
This is not an exhaustive list of IANA relations the API may emit — any IANA-registered relation can appear on a response. Match by rel string and ignore links whose relation you do not understand.
Filtering links in code
When you need to act on one of these relations, match the link by its rel value as a string. For pagination relations, you typically also want to filter out anchored links (which apply to a single item rather than the resource as a whole — see Anchoring).
python
def find_link(body, rel):
return next(
(link for link in body["links"]
if link["rel"] == rel and "anchor" not in link),
None,
)
next_page = find_link(payments, "next")
if next_page:
payments = requests.get(next_page["href"], headers=auth).json()javascript
function findLink(body, rel) {
return body.links.find(link => link.rel === rel && !link.anchor);
}
const nextPage = findLink(payments, "next");
if (nextPage) {
payments = await fetch(nextPage.href, { headers: auth }).then(r => r.json());
}