Advanced Querying & Assets
Type-Safe Filter Operators
- Strings:
eq,contains,starts_with,in. - Numbers:
eq,gte,lte,between. - Arrays:
any,every,none(used for string[], int[], reference[], etc.). - Logical: Use
and: [...]oror: [...]to wrap multiple filter objects. - Reference: You can use nested filters for filtering out your entries by the fields of the reference types linked to your entry. For example filtering out blog posts by author.
For more filtering examples please check out our filtering document.
Nested Preloading
For deep relations, use the nested array syntax. This allows you to fetch multiple levels of data in a single round-trip to the API:.
const post = await client.getEntry(BlogPost, 'id', {
// Preload Comments, and then preload the Commentrs Author
preload: [['Comments', ['Author']]]
});
Media Management
The upload method handles multi-part form data for you, returning a referenceable ID.
const file = await client.upload(myImageBlob, 'header.png');
// Use file.id when creating or updating entries with image fields
await client.updateEntry(BlogPost, 'id', { FeaturedImage: file.id });