Generate a Public URL

Prev Next

Generate a public URL to a media holder


When viewing an asset there is an opportunity to generate a public URL to a media file.

It is necessary to have defined site URL: System configuration > Site settings > Edit site > URL.

Users for whom allowed public file share (in Media Holder Settings) have access to "Copy Public Link" option.

Using this option users are:

  • able to copy a public URL against active records;

  • able to copy a public URL against the latest version;

  • not able to copy a public URL against the previous version;

  • not able to copy a public URL against inactive records;

  • not able to copy a public URL against expired records;

Note: "Copy Public Link" option can be applied only for original media holders.

There are few ways to copy a public URL per media holder:

  1. From the files panel in item info sheet

  2. Using API with the following endpoints (GET - to recieve already generated link, POST - to generate a link):

    • Internal API: /rest/site/{siteId}/module/{moduleId}/item/{itemId}/holder/{holderId}/getRedirectLinkToCurrentFileVersion

    • Expernal API: /rest/external/site/{siteId}/module/{moduleId}/item/{itemId}/holder/{holderId}/getRedirectLinkToCurrentFileVersion

    Note: "API User" right need to be enabled for the user in order to have access to API.

  3. Sending public redirect URL from single and multiple file fields in actions as link:

#set($singleFileOption = $CurrentItem.findFirstFileInMediaHolder(1932))
#set($singleFileFieldThumbnail = $CurrentItem.findFirstFileInMediaHolder(1935))
#set($multipleFileOption = $CurrentItem.findFirstFileInMediaHolder(1936))
#set($multipleFileOptionThumbnail = $multipleFileOption.findFirstFileInMediaHolder(1937))
#set($multipleFileOptions = $CurrentItem.findFilesInMediaHolder(1936))
{
"itemId": "$CurrentItem.getId()",
"singleFileField" : {
"fileName": "$singleFileOption",
"publicRedirectUrl": "$singleFileOption.toPublicRedirectLink()"
},
"thumbnailSingleFileField" : {
"fileName": "$singleFileFieldThumbnail",
"publicRedirectUrl": "$singleFileFieldThumbnail.toPublicRedirectLink()"
},
"multipleFileFieldFirst": {
"fileName": "$multipleFileOption",
"publicRedirectUrl": "$multipleFileOption.toPublicRedirectLink()"
},
"thumbnailMultipleFileFieldFirst" : {
"fileName": "$multipleFileOptionThumbnail",
"publicRedirectUrl": "$multipleFileOptionThumbnail.toPublicRedirectLink()"
},
"multipleFileFieldAll": [
#foreach($currentMultipleFileOption in $multipleFileOptions)
{
"fileName": "$currentMultipleFileOption",
"publicRedirectUrl": "$currentMultipleFileOption.toPublicRedirectLink()"
}
#if($foreach.hasNext),#end
#end
]
}

Note: Only actions using Velocity Templete Engine are currently supported (Send Email, HTTP).

List of generated public links stores here: Home>Configuration>Metrics>Public Links

73cad2aff4.jpg

Expiration period of copied links is 6 months from the moment of link generation. Link generates each time CREATE (POST) request is executed.

Additional information (scenario - current behavior):

  • User creates a link to the same file again - new link is created, old link remains the same;

  • New file is uploaded or version changed - the redirect url link points to the latest version;

  • Link points to expired item - following links will return "401 Unauthorized";

  • Link points to inactivated item - following links will return "404 Not Found";

  • Site URL is empty - Public Links table is not availeble, message “Site URL is not configured, public links are not available” is shown;

  • Site URL is changed - previously generated links will work with a new Site URL (they need to be re-fetched or site url manually replaced);

  • External API is disabled for the system (in system properties file) - following links will return "404 Not Found".

We cannot guarantee that Copy Public Link functionality will be working correctly for Custom Media Holders that has been used as Destination folder for several different Sources in convertors. Such configuration is not supported!

Upload and store files in Google Cloud Storage(GCS)


Starting from v.17.0.0 upload and store files in Google Cloud Storage(GCS) will be supported.It is controlled by 2 feature flags in webapp.yaml:

encode.webapp.file-storage.default-type

encode.webapp.file-storage.google.enabled

encode:  
  webapp:
    file-storage:
      default-type: GOOGLE
      google:
        enabled: true   

Known limitations:

Single File field is not supported to upload files to GCS

Pausing/resuming file uploads to GCS is not supported

Deletion of Files in GCS


Files uploaded to Universal file fields and store in GCS are not deleted immediately from their storage as it happens to the files stored in local file structure.

When file is deleted via UI, or item with uploaded file is deleted, file stored in GCS (file entity) gets an expiration date that makes it scheduled for deletion. File will be deleted within standard clean-up process that takes place every 1 hour.

For public links, redirect to file will work until the expiration settings of GCS (default is 6 hours), even though the file may be deleted by then.