Fetch by Filter
api
.fetchByFilter({
filters: [
{
operator: '$and', // (1)
filters: [
{
field: 'page.formData.type.value', // (2)
operator: '$eq',
value: 'content',
},
{
field: 'page.formData.id.value', // (3)
operator: '$eq',
value: 'homepage',
},
],
},
],
locale: 'de_DE', // (4)
page: 1, // (5)
pagesize: 10, // (6)
normalized: true // (7)
})
.then((result) => console.log('Found Items: ', result))
.catch((error) => console.error('Failed to fetch items', error));
- Logical operator to combine multiple filters
- Filter by the content type
- Filter by the content ID
- Locale for the response
- Page number for pagination (starts at 1)
- Number of items per page
- Whether to return a normalized response with resolved references
Note
The fetchByFilter
method provides more flexible querying capabilities compared to findPage
.
You can create complex filters using comparison operators ($eq
, $ne
, $gt
, $gte
, $lt
, $lte
, $in
, $nin
),
logical operators ($and
, $or
, $nor
, $not
), array operators ($all
), and evaluation operators ($regex
).
Tip
To improve query performance, consider using the CaaS index fields page.formData.type.value
,
page.formData.id.value
, locale.language
and locale.country
in your filters, especially
for Shop Driven Pages.
Last update:
May 19, 2025