The media files are not visible within the components when using Strapi API

38 Views Asked by At

I'm experiencing an issue with Strapi. I would greatly appreciate your help. Thank you.

strapi panel

I've prepared a component as you can see above, now I will show you the API response.

api response

However, unfortunately, the media inside the component is not visible. ID and content information are available, but there is no image data. While Strapi can display the media data alone, it doesn't display it within the component. I need the image data within my component. How can I solve this?

"@strapi/strapi": "4.20.4",

I would be very grateful if you could help.

1

There are 1 best solutions below

0
ccl0504 On

Populate components

Components and dynamic zones are not included in responses by default and you need to explicitly populate each dynamic zones, components, and their nested components.
https://docs.strapi.io/dev-docs/api/rest/guides/understanding-populate#populate-components

So you need to send query with:

populate[0]=rich&populate[1]=rich.image
// or
populate[0]=rich.image