S-Drive 3.6 Documentation

getS3Endpoint

Returns the storage endpoint URL for a bucket — or for whichever bucket a file lives in. Useful for orgs with more than one configured bucket, where different parent objects or file types can be routed to different buckets (and potentially different endpoints/regions).

This is an optional, supporting piece for anyone making their own direct calls to the storage backend (S3). Most integrations won't need it unless they're bypassing S-Drive's own upload/download flow.

How to call this method

global static String getS3Endpoint()

global static String getS3Endpoint(String objectId, String fileObjectName)

global static String getS3Endpoint(String bucketId)

Three ways to resolve an endpoint, depending on what you already know:

Overload

Use it when...

getS3Endpoint()

You just want your org's default configured bucket's endpoint.

getS3Endpoint(objectId, fileObjectName)

You already have an existing file record's own Id and its file object type, and want that specific file's bucket's endpoint.

getS3Endpoint(bucketId)

You already have a specific bucket's Id (from a cg__SDriveBucketList__c record) and just want its endpoint.

Parameters

Parameter

Type

Description

objectId

String

Id of the existing file record itself (not its parent record) — e.g. an Account File record's own Id.

fileObjectName

String

Full API name of the file object, e.g. cg__AccountFile__c.

bucketId

String

Id of a specific cg__SDriveBucketList__c bucket configuration record. this is the ID that acts as a nickname that was created when you configured the bucket. It is often, but not always, the same as the bucket name. It can be found in the S-Drive Configuration bucket list.

Return value

Returns a String — the storage endpoint URL.

If your org hasn't configured Multi-Bucket Settings for that file object type, this returns your org's default bucket's endpoint without ever looking up the file record.

Example

String endpoint = cg.SDriveTools.getS3Endpoint(existingFile.Id, 'cg__AccountFile__c');