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
james2000james2000 

chatter previews from files uploaded via API

I have an application that use the chatter API to upload file attachments as described in the chatter REST API. I'm doing a multiform POST and I am able to upload the file without issue. However, I'm not getting a preview generated. I'm testing with simple image files (png, gif) and no previews are generated. If I create the exact same post with in the web interface, previews are generated. The file name has the file extension and I'm also setting the proper mime type on the binary multiform part.

 

So is preview generation supported when uploading through the API? If it is supported, are there any tricks or options to doing it? My request looks pretty much just like the example in chatter documentation.

 

Thanks

ChrisOctagonChrisOctagon

Hi James,

 

File previews are not available right away, they are asynchronously generated. Does the preview show up later on?

james2000james2000
The previews are never generated unfortunately.
James_SFDCJames_SFDC

Hi,

 

I'm a engineer at salesforce, if possible could you send me a link to file (you can created a public link in chatter), I'd be interested to see why it's not rendered. Let me know if you're not comfortable with making the file public and we'll work out another way for you to send me the file.

 

Thanks,

James

james2000james2000

I've tried all sorts of files without success. Here's a sample http://www.sfdcstatic.com/common/assets/img/logo-company.png

James_SFDCJames_SFDC

Thanks for the link, could you provide your salesforce.com Organization Id, it will help track down the issue?

 

Setup -> Company Profile -> Company Information.

 

It should start with 00D and be 15 characters long.

 

Thanks,

James

james2000james2000

Org ID is 00D80000000aROA. Thanks for taking a look

James_SFDCJames_SFDC

Hi James,

 

Can you check the pathOnClient is set and contains the file extension.

 

Thanks,

James

james2000james2000

I have it working now. It apparently only looks at the filename parameter of the binary part in order to determine if a preview should be generated. Thanks

James_SFDCJames_SFDC

Yes, that's correct.

 

Pleased it's working for you, that's good feedback I guess you were expecting it to also work by setting the mimetype.