How to populate image two levels deep

Hi folks,

I want to populate data two levels deep. Therefore I wrote the following:

let homepage = qs.stringify({
    populate: '*',
  },{
    encodeValuesOnly: true, // prettify URL
  });

This returns the following JSON:


{
  "data": {
      "id": 1,
      "attributes": {
          },
          "Kompetenzen": {
          },
          "Faehigkeiten": {
          },
          "Techstack": {
          },
          "Stationen": [],
          "Projekte": {
          }
      }
  },
  "meta": {}
}

The nested Object “Projekte” now does contain an image. How can I access it?

1 Like

Here for the same reason. All the docs and StackOverflow posts I see seem to claim that having the populate: '*' will get you nested images, but it’s not happening for me either.

Hope someone can help.

It’s a bit annoying, I couldn’t find an answer neither on stackoverflow nor here. As per my understanding populate: ‘*’ does usually only populate data from the first level.

I think that nested Objects can be accessed with something like
populate: [’*’,
{ populalate: ‘Projekte.Img’
}]
It’s not really straight forward…

1 Like

Yeah same. Not ideal but in short term I added strapi-plugin-populate-deep npm package to my strapi code and now on frontend I’m tacking &populate=deep onto the end of any queries where I need those images nested 2 levels deep.

It’s a way to solve it, but this plugin only supports node up to v14, which means I would have to downgrade, which gives me only more headache with strapi :smiley:

Simply use ?populate=* after the end of api like this http://localhost:1337/api/course-details/1?populate=* you will get all data even though if you want deeper level you can http://localhost:1337/api/course-details/2?populate[Full_Syllabus][populate]=Title,Syllabus_Chapters