Skip to content

Cannot populate fields, components, dynamic zones together in GET api #11836

@milinpaul

Description

@milinpaul

Bug report

Describe the bug

[v4]
I'm trying to setup strapi for our marketing website. I need to create a blog page with title, featureimage(Media) and contents (dynamic zones).
I need to fetch the all the fields including title, featureimage and dynamic zone contents.
But I tried all the possibilities for populating mention in this doc but everything is in vain.

Am I missing something ??

Expected behavior

The GET api should returns as follows:

"data": [
    {
      "id": 1,
      "attributes": {
        "title": "Test Article",
          // Media input
          "featuredimage": {
            "id": 1,
            "alt": "",
            "media": {
              "data": [
                {
                  "id": 1,
                  "attributes": {
                    "name": "17520.jpg",
                    "formats": {
                      // ...
                    },
                    // ...
                  }
                }
              ]
            },
          // Dynamic Zone
           "content": [
            {
              "id": 1,
              "__component": "blogpost.image"
            },
           {
             "id": 16,
             "__component": "blogpost.richtext",
             "value": "this is something fishy"
            }
          ]
      }
  ],
  "meta": {
    // ...
}

System

  • Node.js version: v12
  • NPM version:
  • Strapi version: v4
  • Database: Postgres (Docker)
  • Operating system: OS X

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions