[SalesForce] Content Document download URL params

I spend hours to find a way to control download behavior of pdf-files (when to download and when to show inline) and did not find anything.

What I got so far:

the main thing that do all files magic is

/sfc/servlet.shepherd/ ….

  1. We can download file by:

    • ContentVersion Id – /sfc/servlet.shepherd/version/download/<VERSION>
    • ContentDocument Id – /sfc/servlet.shepherd/document/download/<DOCUMENT>
    • Zip archive by Ids separated by slash – /sfc/servlet.shepherd/version/download/<VERSION 1>/<VERSION 2>?
  2. For some reason in salesforce download links we can find the following parameter operationContext=S1 OR operationContext=CHATER, which seems do nothing

  3. Also servlet.shepherd can show preview image of pdf /sfc/servlet.shepherd/version/renditionDownload?rendition=SVGZ&versionId=<VERSION>, where ?rendition= can be:

    • SVGZ
    • THUMB120BY90
    • THUMB240BY180
    • THUMB720BY480

All these options are not covered by official documentation and I feel there could be much more features. Does anybody know other options? Is there any documentation explaining all possible options?

UPD:
Added option with multiple files download as a zip provided by @cropredy

Best Answer

Looks like there are some changes recently. I am seeing below pattern with API version 48

For authenticated users

/sfc/servlet.shepherd/document/download/06955000001UrOPAA0

For communities

/sfsites/c/sfc/servlet.shepherd/document/download/06955000001UrOPAA0

ID in the URL being content document ID.

Related Topic