Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

807
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda