Can I filter on linked items when retrieving headless content via the GraphQL API endpoint?
In my react native application im using the graphQL endpoint to retrieve the data.
I am trying to get my 'related' insights based on a linked categories field
Like this :
CollectionName(languageName: "nl", useLanguageFallbacks: true) {
items {
insights(where: { categories: { some: { categoryKey: { in: ["Data"] }}}}) {
items {
teaserImage {
path
}
articleTitle
articleDescription
introTitle
introText
articleBody
articleConclusion
categories {
items {
categoryKey
categoryValue
}
}
publishDate
}
}
}
}
}```
I got the follwoing error
`The specified input object field 'categories' does not exist.`
**It seems like I am not able to acces 'linked' fields. **
I alrady tried this, like the docs are also mentioning:
{ CollectionName(languageName: "nl", useLanguageFallbacks: true) { items { insights { items { teaserImage articleTitle articleDescription introTitle introText articleBody articleConclusion categories (where: { categoryKey: { in: ["Data"] }}) { items { categoryKey categoryValue } } publishDate
}
}
}
}
}
Then I retrieve all the insights and it just filters the categories inside it.
Thanks in advance!
---
**Environment**
- Xperience by Kentico version: [28.4.1]
- .NET version: [8]
- Deployment environment: [Local|Azure]
- Link to relevant [Xperience by Kentico documentation](https://docs.kentico.com/developers-and-admins/development/content-retrieval/retrieve-headless-content#basic-querying)
Answers
I have tried to find a solution but unfortunately I am unable to query nested content items.
Your insights give a ItemSorter and ItemFilter. These only contain the standard field like text or date fields from your item.
I cannot query a Content Item field from the parent. Only can filter on the direct item.
This would imply that collecting data if you have a lot of sub items will cause serious load.
I hope there will be a fix for this or a workaround.
To answer this question, you have to login first.