Contentful logo

Contentful Community

getEntry only returning part of the content

I’m tryng to fetch a single piece of content via its entryId. The content model has some of its own properties and then it references another piece of content (a different content model). The response I’m getting to this parent content model actually only contains the referenced content.

It’s all nested properly in the getEntries response. Is it possible to fetch a single entry in its entirety? I noticed include isn’t valid with single entries

Hi :wave:

Use the getEntries function and filter by the single entry ID you want to retrieve, like so:

let entry_id = 'abc123'
environment.getEntries({'': entry_id}).then(response => {
  // response.items[0] will be the entry you are requesting and all referenced entries will be included.
  entry = response.items[0]
1 Like

Thank you! This works like a charm.

can you help me with multiple content? i am stuck