S-Drive 3.6 Documentation

getThumbnailURLs

Returns temporary, expiring URLs for multiple file thumbnails at once — the batch version of getThumbnailURL.

Only works for files that already have generated thumbnails. S-Drive generates thumbnails automatically for supported file types (documents, images, videos) when the Preview and Thumbnail feature is enabled . If some files in the list do not have thumbnails, the returned value for those will be “N/A”. If none have thumbnails, it will return an error.

How to call this method

global static List<String> getThumbnailURLs(List<ID> parentIds, List<ID> fileObjectIds, Long timeValue)

global static List<String> getThumbnailURLs(List<ID> parentIds, List<ID> fileObjectIds, Long timeValue, Map<String,String> requestParameters)

global static List<String> getThumbnailURLs(List<ID> parentIds, List<ID> fileObjectIds, Long timeValue, List<Map<String,String>> requestParametersList)

Three overloads: a plain batch, one that applies the same extra request parameters to every file, and one that lets you specify different request parameters per file.

Parameters

Parameter

Type

Required

Description

parentIds

List<ID>

Yes

Salesforce Ids of the parent objects, one per file, in the same order as fileObjectIds.

fileObjectIds

List<ID>

Yes

Ids of the file records to get thumbnail URLs for. To get an older version's thumbnail, use that version's file record Id.

timeValue

Long

Yes

How long the URLs stay valid, in seconds.

requestParameters

Map<String,String>

No

Extra request parameters applied to every URL — most notably response-content-disposition: include "inline" for a URL that displays the thumbnail in the browser, or "attachment" for one that downloads it.

requestParametersList

List<Map<String,String>>

No

Same idea, but one map per entry in fileObjectIds, same order, for setting different parameters per file.

Return value

Returns List<String> — one thumbnail URL per entry in fileObjectIds, in the same order. For files that don’t have previews, “N/A” will be returned for the file’s URL.

Example

List<String> thumbnailURLs = cg.SDriveTools.getThumbnailURLs(parentIds, fileIds, 300);















This method is used to get multiple thumbnail URLs for multiple objects of an S-Drive Attachment at a time.


List<String> getThumbnailURLs(List<ID> parentIds, List<ID> fileObjectIds, Long timeValue)


List<String> getThumbnailURLs(List<ID> parentIds, List<ID> fileObjectIds, Long timeValue, Map<String,String> requestParameters)


List<String> getThumbnailURLs(List<ID> parentIds, List<ID> fileObjectIds, Long timeValue, List<Map<String,String>>
requestParametersList)

Parameters:
parentIds: List of Salesforce ids of the parent objects. You can use 15-character id or 18- character id.
fileObjectIds: List of Salesforce ids of the attachment (files) objects.
timeValue: Expiration time of the links in seconds.
requestParameters: Map of request parameters and theirs values to set the parameters in the response (e.g. ('response-content-disposition', 'inline; filename=myfile.png')). For more information, visit the Amazon documentation:
http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGET.html
requestParametersList: List of request parameters map for each file.
Return Value: The method will return the list of thumbnail URLs of the S-Drive attachment.

If you would like to get thumbnail URL of an old version of a file, you should add id of an old version file into fileoObjectIds list.