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
javamatejavamate 

Displaying image preview for ContentPost attachment (v24.0)

I have a Chatter client (in-browser on non-saleforce.com domain) that I am trying to enhance to support the display of image previews for attachments to ContentPost feed items in v24.0 of the Chatter REST API.  I see that the Feed Item Attachment: Content response body contains a property called hasImagePreview which returns true or false.  What I don't see is any kind of reference to the preview image.

 

I read the post on Download Attachments via Chatter REST API and I understand that in order to display the full image I would need to download it by pasing in the OAuth token in the request header.  I presume the same would be true for the preview image, but I'm unclear how to get the preview image.  Is there an extra parameter that needs to be specified with the request to the downloadUrl in order to get the preview?

Tom GersicTom Gersic

You want to take a look at the rendition parameter, documented here:

 

http://www.salesforce.com/us/developer/docs/chatterapi/Content/connect_resources_files.htm?SearchType=Stem&Highlight=Rendition|rendition|renditions

 

For instance,

 

/services/data/v23.0/chatter/files/[SOME FILE ID]/content?versionNumber=1&rendition=THUMB120x90

Tom GersicTom Gersic

Scratch that, what you actually want would be more like this:

 

/services/data/v24.0/chatter/files/[FILE ID]/rendition?type=THUMB120BY90

 

javamatejavamate

Thanks, Tom.  This seems like it might work, however I am now getting the following response.

 

[ { "message" : "The files API is not enabled for this organization or user type", "errorCode" : "API_DISABLED_FOR_ORG" } ]

 

I have tried to find documentation on enabling the files API but without success.  I'm using v24.0 of the Chatter REST API.

 

Anybody know how to enable the files API?

 

Thanks,

Eric

Tom GersicTom Gersic

I think you need to file a ticket under Help in order to have Salesforce enable the Files API.