How to list entry's linked fields

Hi. I’m a little confused about how to retrieve a list of all the linked fields in an entry.
For example, I have a content type of landingPage that contains a field called sections which is a link to many content types.
I want to retrieve a list of how many linked entries ‘sections’ had.

I followed these instructions from the guide which I thought was my case but it’s not working:

Links to a specific item
If you want to retrieve all items linked to a specific entry, the query URL should filter entries on their specific content_type , linking_field (field to link items) and entry_id from the target entry.

My query:

const entries = await client.getEntries({
    content_type: 'landingPage',
       '': '2MdUQKIq7mqqguMaKsSkoE',
        include: 5

In this specific entry I have 3 sections but I get a response with the total:0 . What am I doing wrong?

1 Like

Hi Gisete,

Are you trying to retrieve the actual content of these linked items or simply the number amount of items that were referenced in that field?

Hi @gabriel, I’m trying to retrieve the content of the linked items.

Hello Gabriel,

I want the content of entry and I used the same way as Gisete. But the result is zero.
A bit more exact, I want the content of a textbox. Inside these box is a bullet point list. When I fetch the data just with:

client.getEntries({content_type: ‘recipeSection’})
.then(res => setRecipes(res.items))

then I get a list of deep nested objects. Every list item is an own object. What a pain. Can you recommend me a way, how I get my data in a better way? I expected something like one object witch is holding my HTML code.

Thx in advance.

Regards Marcus

Hi @koch.marcus01

I believe you might refer to RichText format, that so far is the only one that, when represented as JSON has a lot of ‘deep nested objects’.
To parse the element correctly, you will need to use one of the renderer, as shown here:

1 Like