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

178
Visualizações
Retrieve image form Salesforce API for rich text field

I am using this API to retrieve an image from SF and show it in img tag

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_rich_text_image_retrieve.htm

I am using axios to send a get request like this

const headers = {
  Authorization: `Bearer ${token}`,
  responseType: 'arraybuffer',
};

const url =
  'https://saas-force.salesforce.com/services/data/v50.0/sobjects/objectName__c/a0K1X000004Z8lI/richTextImageFields/Rich_Text_Field_Name__c/0EM1X000000MFDu';

const response = await axios.get(url, { headers });

img.setAttribute('src', `data:image/jpg;base64,${response.data}`);

The response looks like this once I log it in console enter image description here

and from network enter image description here

But the image is always showing as corrupted in html enter image description here

it seems that there should be a different ways to deal with this type of response, I tried many approaches, but still didn't successed

about 4 years ago · Juan Pablo Isaza
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