How to query the content of nested components?

System Information
  • Strapi Version: 4.0.7
  • Operating System: macOs Monterey
  • Database: sqlite
  • Node Version: v14.17.3
  • NPM Version: 6.14.13
  • Yarn Version: 1.22.10

I’ve created a component “Carousel” and another component “Carousel Item”. Using the media with multiple images isn’t an option because the carousel will have more content.

For the sake of the example, let’s say that the “Carousel Item” has the fields “image” (media) and content (text).

The “Carousel” component has the field “item” which is of type component, “Carousel Item”.

I’ve created a collection type, “Page”, which has a dynamic zone, “Sessions” where a “Carousel” can be chosen.

On the admin, I can create pages and add a carousel to it and then add many carousel items.

The issue there I’m facing is that when I get the content of pages, even though I’ll get the array of sessions as expected and have the sessions containing the carousel, the carousel items won’t be listed in the response.

E.g:

http://localhost:1337/api/pages?populate=*

Response:

{
    "data": [
        {
            "id": 1,
            "attributes": {
                "createdAt": "2022-02-18T07:02:07.783Z",
                "updatedAt": "2022-02-18T07:28:38.441Z",
                "publishedAt": "2022-02-18T07:09:36.351Z",
                "pageSessions": [
                    {
                        "id": 2,
                        "__component": "page-block.logos-carroussel"
                    },                   
                ]
            }
        }
    ],
    "meta": {
        "pagination": {
            "page": 1,
            "pageSize": 25,
            "pageCount": 1,
            "total": 1
        }
    }
}

Please advise on how I can query not just the carousel, but also the carousel items within the pageSessions.

Thanks in advance

Following up with this, I’ve did more research and added a more complete question to this forum. For reference: