Can't see images in api endpoint, but they show up in graphql playground

System Information
  • Strapi Version: v4.0.0
  • Operating System: Ubuntu 18 in WSL2
  • Database: sqlite
  • Node Version: v14.18.1
  • NPM Version: v6.14.15
  • Yarn Version:

I’ve just created a quickstart project. Added a single type content type called test with an image and a text field. Updated the roles to allow find on the content type. And tried querying with the graphql playground as well as going to /api/test

The graphql query returns the results with the image but the api doesn’t return anything about the image.

Can anyone help me get this configured correctly? The image has also been uploaded to the file system.


I am also facing the same issue. Tried everything in the API docs, no trace of image data from the API.

If you are using the latest version v4 you have to populate when querying
https://forum.strapi.io/t/image-url-not-showing-on-api-call-strapi-v4/12956
i hope this is what you ment

1 Like

is there any way to populate using query engine when images are available under component within component lying under dynamic zone.
Attribute in Schema.json

"attributes": {
    "section": {
      "type": "dynamiczone",
      "components": [
        "clps-components.banner",
        "clps-components.carousel",
        "clps-components.promotional-banner-with-products",
       ...
      ],
      "pluginOptions": {
        "i18n": {
          "localized": true
        }
      },
      "required": true
    },
    "category": {
      "type": "relation",
      "relation": "oneToOne",
      "target": "api::sub.sub-categories"
    },

I am trying to populate all the nested images in components in dynamic zone using query engine api,

await strapi.db.query("api::xlps.xlps").findOne({
        where: { locale: language, category: { id: category.id } },
        populate: ["section", "category"],
      });

Here everything is being populated except the media files. Can you suggest how it can be done without using Rest API.