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

177
Views
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
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!