why Strapi dont fetch relationship in retrived data?

0

Issue

I created an API using strapi, and everything work fine until now.
A have an "Event" and a "Stand" collection, I set up things in order to have multiple stands in event.

enter image description here

enter image description here

I use Insomnia to try the API and fetch the data, and when I fetch the events, I dont have any clue of the relations.

enter image description here

Everywhere people say relations should appears here, so, if you have any ideas, thank you.

Solution

Strapi won’t retrieve by default the relations.
You must specify in your API call that you want to retrieve everything including the relationships.

For that, at the end of your GET request add : ?populate=*

request: http://localhost:1337/api/events?populate=*

You have more options here is you want to see deeper or not :

https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#relation-media-fields

Answered By – Paul Corbeau

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More