Field not coming in the json #26605
Unanswered
FFontes-CMH
asked this question in
Frontend - React/Next.js
Replies: 1 comment
|
I think the issue is the /api/destaques?filters[ativo][$eq]=true&populate=imagem&sort=ordem:ascIn Strapi REST, relations/media/components are not returned by default. Each relation has to be populated explicitly. So pagina_conteudo will not appear unless you add it to populate. Try: /api/destaques?filters[ativo][$eq]=true&populate[0]=imagem&populate[1]=pagina_conteudo&sort=ordem:ascOr with object syntax: /api/destaques?filters[ativo][$eq]=true&populate[imagem]=true&populate[pagina_conteudo]=true&sort=ordem:ascIf you need fields from inside pagina_conteudo, use nested populate/fields, for example: /api/destaques?filters[ativo][$eq]=true&populate[imagem]=true&populate[pagina_conteudo][fields][0]=titulo&populate[pagina_conteudo][fields][1]=slug&sort=ordem:ascAlso check permissions: the role/token used by the frontend must have find permission for the Pagina content type. If the relation is populated but the related content type has no permission, Strapi will not return it. So the checklist is:
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi! I have a collection type called Pagina





This collection has a relation in other collection called Destaques (as you can see in the pagina_conteudo)
Te problem is, the field pagina_conteudo is not in the json but it only happen for this relation, if I select other type and pick other relation, the data it is on the json.
The enpoint /api/destaques?filters[ativo][$eq]=true&populate=imagem&sort=ordem:asc retorns
but no pagina_Conteudo there. If I select other type, as in the next print, the data is on the json
Why is that happening only for pagina_Conteudo?
Thank you!
All reactions