I have added a single image media type to a content-type that i have. The image is uploaded and visible in the admin UI, but the image url is not a part of the API response. The only way that i can see the uploaded image url is through the admin panel. Am i missing something?
If i attach the same image to the CKeditor, then the API response will show the url as part of the editors text. The content-type model information in the postgres db doesnt even show a column for the image upload that is part of my content-type.
1 Like
Did you try to populate your image field?
I have done something like this:
const avgParams = {
_where: {
'user.company_size': userCompanySize,
},
};
const populate = [
'avatar',
];
const entitiesPromise = strapi.services.result.find(params, populate);
3 Likes
That did actually work! Thanks for the information. Why would i have to explicitly add that field into my response? Its part of my content-type, why is that not returned by default? That seems like a bug…
If the media is nested below 1 level it’s possible it couldn’t be populated. Are you using a custom controller you modified?
No its not nested, but i am using a modified version of the controller. I guess the issue comes from how the image is saved in the db. Because when i look at the db columns for this content-type, there is no mention of the ‘event_image’, which is how its named. So thats why it never dawned on me to try to add field manually like @landorid suggested.