Search code examples
strapi

How to get all information from a related collection in strapi v4?


I have created a collection (favorite) related to product and user. My product collection has a field called images but when i make a GET request to favorites i dont get back the images. I have all permissions active for users. This is my query http://192.168.0.102:1337/api/favorites?populate=product&filters[user][id][$eq]=4.

I am following: https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/filtering-locale-publication.html#filtering

FAVORITE COLLECTION PRODUCT COLLECTIONGET REQUEST


Solution

  • Images are also considered to be 'relations' on a collection. You need explicitly tell it to populate those, see populating two levels: https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#relation-media-fields