Includes
Last updated
Last updated
With the parameter includes
you can aggregate relations for a document that were defined by relation fields
for a content type
.
GET
https://api.cmft.io/v1/<repoName>/<endpoint>?includes=<level>
Name | Type | Description |
---|---|---|
A level of 1
would aggregate all relations, from all relation fields, of the first level.
A level of 2
would also return all of the relations to those documents of the first level. The maximum number of levels is 5
.
GET
https://api.comft.io/v1/<repoName>/<endpoint>?includes[<field>]=1
If you just want to include the relations from a single or multiple specific fields, you can define these fields in your query.
The notation for fields is similar to filters. You can either include a contentType
as field prefix, or a wildcard (*).
or
To query multiple levels (relation of a relation...) with the field syntax, fields can be chained:
Field types which contain references are the following:
relation field
asset field
From a technical perspective, assets are relations and by default they are treated like that.
But sometimes assets, for example images, can be seen as a piece of content that you want to be included within a document field. For this case, you can use the embedAssets
parameter.
Find some examples on the includes example page:
Name | Type | Description |
---|---|---|
repoName
string
The API identifier of the repository
endpoint
string
The endpoint you'd like to query
include
number
The levels of includes
repoName
string
The API identifier of the repository
endpoint
string
The endpoint you'd like to query
include
string
The field path you'd like to include