I have content type (home page) with a field referencing another content type (section). Within that content type, I have a field with a reference to 1 of many (section items). When I run getEntry and query the home page, I am not getting all the data returned. I am not getting the fields for the section items. Any ideas?
Hi @jason.justice,
Could you confirm if you’re using an appropriate level of include
and that you have link resolution enabled in your client setup? (resolveLinks: true
)
I’m not sure how to answer the first question.
I’m doing this to get the entry content
client.getEntry(‘THISISTHEIDOFMYPAGE’)
For the 2nd, where do I enable this?
OK I read the linked support doc. I get the concept but would this now require me to make 2 call to the API for content. One for the page and another to get the linked items? Ideally I’d like to just make 1 call for the page content and get everything. Is this possible?
I first missed you were querying a single item (getEntry
). It wouldn’t be required at all to make two requests.
Instead, you can use a query on the lines of the query:
getEntries({include: 3, ' sys.id' ': 'EntryID'}
The include
parameter unfortunately doesn’t work in the single entry endpoint, so you’d use the /entries
endpoint narrowing it down to that specific item.
Let me know if that makes sense or if you have any other questions
Thanks! So the entryID can still be the ID for the entire page. Correct?
If your page is based entirely on that given entry (including referenced items), then that’s correct.
I got it working. Thank you. Is the value of the ‘include’ parameter relative to the number of levels down I’m going into the content? I’m a little confused there.
That is correct. The include
parameter indicates how many levels of resolving you’d like in your query.
hi, i tried using the include parameter… so all the fields which have reference in the page just show
‘names’: [Array]
If i have to get the value within this field as well? what should i do?