Best way to deep populate a dynamic zone with media

System Information
  • **Strapi Versionlatest:
  • **Operating SystemMacOS:
  • **DatabaseSQLlite:
  • **Node Version18:
  • NPM Version:
  • **Yarn Version1.2:

The documentation shows how toDeeply populate a dynamic zone with 2 components​. This seems to work for one of my components:

http://127.0.0.1:1337/api/landing-pages?filters[url][$eq]=/&populate[pageComponents][populate]=*

would return:

{
    "data": [
        {
            "id": 1,
            "attributes": {
              ...
                "url": "/",
                "pageComponents": [
                    {
                        "id": 2,
                        "__component": "banners.hero-banner",
                        "heroImage": {
                            "data": {
                                "id": 2,
                                "attributes": {
                                    ...
                                    "url": "/uploads/hp_pic_8902fa26a7.png",
                                }
                            }
                        },
                        "cta": [
                            {
                                "id": 3,
                                "text": "Our services",
                                "url": "/services"
                            },
                            {
                                "id": 4,
                                "text": "Case studies",
                                "url": "/case-studies"
                            }
                        ]
                    },
                    {
                        "id": 1,
                        "__component": "banners.logo-banner",
                        "title": "Technologies we use",
                        "logo": [
                            {
                                "id": 1,
                                "title": "Git",
                                "alt": "Git version control"
                            }
                        ]
                    }
                ]
            }
        }
    ],
    "meta": {
        "pagination": {
            "page": 1,
            "pageSize": 25,
            "pageCount": 1,
            "total": 1
        }
    }
}

As you can see, it populates our Hero-banner component complete with media. However, it does not seem to populate the logo banner media pieces. Am I missing something here? I would have thought it would populate everything.

Considering I have a custom page builder, where I can drap/drop many different optional components, how could I build one catch-all query without knowing all the components ahead of time?

Ty

I ended up using a query similar to this:

http://127.0.0.1:1337/api/landing-pages?filters[url][$eq]=/&populate[pageComponents][on][banners.logo-banner][populate]=logo.image&populate[pageComponents][on][banners.hero-banner][populate]=*

Which still requires me to know ahead of time what we are building. I’d be interested in knowing if there is a better way…