Interacting with the API endpoints from Postman
Launch Postman if it was not running and try accessing the /api/tutorials
endpoint. We should be able to see the tutorial data return in the API response; however, there is no classroom data returned in the response at all. This is because, by default, Strapi does not populate relations when fetching data, and we will need to explicitly specify that we would like the relation to be populated using the populate
API parameter. So, let's update the URL by appending the populate
parameter to it. The URL should look like this: /api/tutorials?populate=*
. This time, we can see the tutorial data, including the Classroom relation.
What Is the populate
Parameter?
The populate
parameter is one of several parameters included with Strapi out of the box that we can use to customize the responses from the API. We will cover this in detail later on in Chapter 6, Dealing with...