Links

Links are a powerful way to model relationships between content entries and assets. You can learn more about links in our concept guide.

Retrieval of linked items

When you have related content (e.g. entries with links to image assets) it’s possible to include both search results and related data in a single request. Using the include parameter, you can specify the number of levels to resolve.

The maximum number of levels is 10. The API will throw a BadRequestError for higher values or values other than an integer. The default number, if the parameter is not specified, is 1. To omit linked items, specify include as 0.

If the standard items array has not already retrieved the linked entries, they will be in the includes.Entry array. Linked assets are inside the includes.Asset array.

Note: The include parameter resolves links between entries and assets within a space. Links between content types within a space are not included in the response.

Note: The include parameter is only available for the entry collection endpoint /spaces/{space_id}/environments/{environment_id}/entries.

To query entries with linked items, use the Get all entries of a Space endpoint, see example:

/spaces/yadj1kx9rmg0/environments/staging/entries?access_token=f0aa56e3659d58947f8e3ddd6301c9591c9b73a8b54c35435233b18b3e6752d5&include=2

If you want to retrieve all items linked to a specific entry, the query URL should filter entries on their specific content_type, linking_field (field to link items) and entry_id from the target entry.

To query entries linked to a specific entry, use the Get all entries of a Space endpoint, see example:

/spaces/yadj1kx9rmg0/environments/staging/entries?access_token=f0aa56e3659d58947f8e3ddd6301c9591c9b73a8b54c35435233b18b3e6752d5&include=2&content_type=2PqfXUJwE8qSYKuM0U6w8M&fields.brand.sys.id=4LgMotpNF6W20YKmuemW0a