function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
florianhoehnflorianhoehn 

Cannot access images in rich text fields coming from REST API

Hi everyone,

 

I have a big problem that I cannot get my head around:

 

We created a REST API that returns an object with a rich text field in it. It displays beautifully without any trouble IF you are logged in to Salesforce.com directly. If however you are only using OAUTH to authenticate it cannot access the images of this rich text field.

 

Here an example JSON for a rich text field as we get it in html format:

 

...

"article" : "<p class=\"MsoNormal\"></p>\n<p class=\"MsoNormal\" style=\"text-align: center; \"><img src=\"https://c.eu2.content.force.com/servlet/rtaImage?eid=a06b0000003Xvrq&amp;feoid=00Nb0000000yu5o&amp;refid=0EMb0000000Kyui\" alt=\"User-added image\"></img></p>"

...

 

How can it be that I can get all text and formatting ok but not access the image via OAUTH?

 

Any help would be greatly appreciated!

 

Florian

alessio.valentinialessio.valentini

I would need more stuff like logins ecc..

 

could this be useful?

 

http://developer.force.com/cookbook/recipe/converting-a-rich-text-area-fields-image-for-api-upload

florianhoehnflorianhoehn

Thanks but this is for the upload via the API, I need the download.

alessio.valentinialessio.valentini

Have you already tried to set the token scope to FULL? (this allow api + web access)

florianhoehnflorianhoehn

yes. That was the one thing that I thought would make sense if it would fix it. Unfortunately it didn't.

alessio.valentinialessio.valentini

Have you tried to change the inital url with something like this?

 

https://sites.secure.force.com/success/servlet/rtaImage?eid=a06b0000003Xvrq&feoid=00Nb0000000yu5o&refid=0EMb0000000Kyui

alessio.valentinialessio.valentini

Have you tried to append the token at then end of the url?

 

ex

 

var oldUrl   = 'https://c.eu2.content.force.com/servlet/rtaImage?eid=a06b0000003Xvrq&amp;feoid=00Nb0000000yu5o&amp;refid=0EMb0000000Kyui'

 

var newUrl = + 'oauth_token=' + access_token

alessio.valentinialessio.valentini

*pay attention to append using the &... so it becomes

 

var newUrl = + '&oauth_token=' + access_token

 

 

Vikas Malhotra.ax1630Vikas Malhotra.ax1630

Hi Alessio,

 

I am facing the same problem, and I have tried whatever have been suggested so far without any luck. Please let me know if there is anything that can be done to access the image using oauth.

 

Regards,

Vikas Malhotra