Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

806
Views
strapi not returning image url as attribute

I'm trying to built a small picture gallery with svelte and strapi v4 for learning purposes. I have my content type configured as shown in picture 1 (Picture 1, content type) and this is the code I use to make the get request to my strapi backend:

onMount(async () => {
try {
    const response = await instance.get("/api/picture-blog-posts")
    console.log(response);
    
} catch (e) {
    error = e
}

}) I added a few pictures through the Strapi Admin Panel and published them. I was thinking, that I would get the image url as an attribute, but I don't: The data response I get. I am not sure what I am supposed to different or where my problem is, because the response has all the data except the image data :/
So help will be very much appreciated. Also I will gladly add more details, if you think they are needed. Just trying to keep it concise...

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

To improve performance, Strapi V4 doesn’t return media files or relation data by default. Thus, you will need to adapt your request as it is outlined in the docs:

https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest-api.html#fields-selection

Example with using axios and qs:

  const query = qs.stringify({ 
      populate: '*',
      fields: '*',
      publicationState: 'live',
      locale: ['en','de'],
    }, {
      encodeValuesOnly: true, // prettify url
    });
    

    const url =`${REPLACEWITHYOURBASEURL}/api/settings-header?${query}`;   
    
    const result = await axios.get(url);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!