Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

808
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda