Contentful logo

Contentful Community

Get an entry with its assets

Hello,

When getting data from one single entry using the API, the include array is not supported therefore i do not get the details of the linked assets & contents.
Is there a way to get it, apart from doing several API calls one after the other?
This seems far from optimal for performances reasons

https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/entries/entry/get-a-single-entry/console

Thanks and regards,
Marie

Hi Marie, you are right that the include parameter is only acceptable when retrieving entry collections, here is an example workaround in curl:

GET /spaces/{space_id}/environments/{environment_id}/entries?sys.id={entry_id}&include=2

Then you will find the links under “includes”/“assets” in the API response; If you are using official SDKs, the links will be automatically resolved.

Thanks a lot for the helpful tip Alma, this works perfectly!

Regards,
Marie