Skip to main content
Version: 5.7.0

GetCDNUrl

tip

This method was added to support clients (like very old versions of Unity - i.e. circa 2016) that cannot handle HTTP Redirects. This method allows clients to pre-resolve the CDN endpoint for the file to download.


This call is not required in the great majority of cases. Just use the regular file download URL and the platform will automatically re-direct the client to the appropriate CDN URL.

Returns the CDN url for a file object.

ServiceOperation
fileGET_CDN_URL

Usage

http://localhost:3000
string cloudPath = "dir1/dir2";
string cloudFilename = "filename";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.FileService.GetCDNUrl(cloudPath, cloudFilename, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"appServerUrl": "https://api.braincloudservers.com/...f434b1db538b/f/uploadsimplefile.txt",
"cdnUrl": "https://d2b6zwnvr1nyug.cloudfront.net/bc/g/20001/u/107b3aa9-0d9f-4e90-af..."
}
}
Common Error Code

Status Codes

CodeNameDescription
40431CLOUD_STORAGE_SERVICE_ERRORCloud storage service error
40432FILE_DOES_NOT_EXISTFile does not exist

Method Parameters

ParameterDescription
cloudPathFile path
cloudFilenameName of file