简体   繁体   中英

Get an Image from a Rich Text Area Field (salesforce)

I am facing some problem with retrieving the images from Salesforce fields.

I am trying to follow this link , but I am not able to get the binary form of the image.

Following is how my data looks:

{
  "attributes": {
      "type": "lord",
      "url": "/services/data/v42.0/sobjects/lord/000000GrWZAA0"
  },
  "Id": "000000GrWZAA0",
  "Solution__c": "<img alt=\"User-added image\" height=\"187\" src=\"https://company--d.na6.content.force.com/servlet/rtaImage?eid=ka380033330GrWZ&amp;feoid=00N82222205DIbz&amp;refid=0EM45430000kCBr\" width=\"500\"></img>"
}

So referrring the link , I created a GET request as mentioned in the Salesforce documentation:

https://company.my.salesforce.com/services/data/v42.0/sobjects/lord/000000GrWZAA0/richTextImageFields/Solution__c/0EM45430000kCBr/body

with header:

Authorization: Bearer token

After making a request, I get the following error:

[
    {
        "errorCode": "NOT_FOUND",
        "message": "The requested resource does not exist"
    }
]

Can someone please throw some light on what am I missing. everything looks good to me, but I am guessing I am missing some silly thing in this easy piece of code.

Also, I have looked upon many other threads about accessing, but since I am using NodeJS (REST API), I am not finiding the best solution that I can proceed with. The one I am referring is the above one which I am stuck at.

It would be great if someone can help me with this or maybe direct me towards an other way to access this image link to public. I am using: NodeJS, and NPM Module JSFORCE for my implementation.

TIA

Could you please try changing the version from 42.0 to 43.0 and also remove the '/body' part from the request. I think that should work.

https://company.my.salesforce.com/services/data/v43.0/sobjects/lord/000000GrWZAA0/richTextImageFields/Solution__c/0EM45430000kCBr

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM