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/ ….
-
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>?
- ContentVersion Id –
-
For some reason in salesforce download links we can find the following parameter
operationContext=S1
ORoperationContext=CHATER
, which seems do nothing -
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
For communities
ID in the URL being content document ID.