System Information
-
Strapi Version: v.1.1.11
-
Operating System: Windows11
-
Database: Postgress
-
Node Version: v.16.13.1
-
NPM Version: v.8.1.2
-
Yarn Version: -
I am using populate to populate image named as leftLogo which is inside Footer,
So to access that in populate I need to use populate[2]=Footer.leftLogo
but in the image I only want to get the url, I tried multiple ways but I wasn’t able to get only url from a populated data.
1 Like
Here is an example of how I have done this.
let restaurants = await strapi.entityService.findMany(
"api::restaurants.restaurant",
{
fields: ["ordinal", "feature_type", "width"],
populate: {
restaurant: {
fields: ["title"],
populate: ["lead_image"],
populate: {
tags: { fields: ["tag"] },
room_types: { fields: ["price", "start_date"] },
lead_image: {
fields: ["alternativeText", "width", "height", "formats"],
},
},
},
},
sort: ["feature_type", "ordinal"],
}
);
2 Likes
You used something of Strapi??
strapi.entityService one
I was using normal url to get those, ohk so this way I can get this,
I am newbie to Strapi, I have a doubt whether I should use axios or this strapi module??
You mentioned: axios, so you’re doing it on the frontend.
From some experiences I’ve had: It’s better to do it in the backend!
Create a custom route and controller then use entityService as mentioned by @knowncolor
Hope that helps