Strapi Populate not working

Hi all - I am struggling to find a solution for my API data. My design is that “Albums” have a one-to-many relationship with “songs”. In general, an Album can have many songs, but a song can be part of one Album only.

http://localhost:1337/api/albums?populate=* - gives me all Album data (incl. Album cover image etc) but song does not have data for song file, song image etc

http://localhost:1337/api/albums?populate[songs][populate]=* - gives me all the song data (like song file, cover image etc) but the Album does not show data like Album cover image etc

I am not able to display all the Album data and the Song data in one api. Can someone please help me?

Thanks
J

After breaking my head, and pulling my hair, I was finally able to find a solution. I hate to say this, but making the API complex is such a foolish strategy. If the team is worried about performance, then they should allow for options and not completely disable it.

The solution.

  1. Install strapi-plugin-populate-deep - npm
  2. Build your admin
  3. Use /posts?populate=deep to get up to 5 levels deep of data. You can customize up to 10

Strapi, you have to strategize better, not get on the nerves of your users. A headless CMS should ideally simplify things, not complicate them.

Best of luck guys!

2 Likes