Public links
In Sitecore Content Hub, on the asset details page, you can make renditions public. This means that, unlike other files, the file is accessible using a URL that is not pre-signed. Anyone who knows the static URL can cache and fetch the file.
Request URL
The request URL has the following format:
https://{HOST}/api/public/{RESOURCE_TYPE}/{RELATIVE_URL}?{V}
You do not need to send the request directly to the media delivery service (MDS). The request URL is built transparently when using Content Hub.
The following table lists the parameters of the requested URL.
Parameter |
Description |
---|---|
|
Identifies the type or category of the resource being accessed in the URL, for example an image, document, or video. Generated automatically. |
|
Specifies the relative path or location of the resource within the system. By default, the system assigns a value, but you can modify it to customize the URL path for better readability, organization, or to meet specific requirements. |
|
The version number of your content item. Generated automatically to ensure you always get the latest version without having to wait for the browser cache to expire. |
|
A transformation parameter. User generated. Optional. |
|
An image merging parameter. User generated. Optional. |
Expiration date and time
You can configure the public link to expire after a certain amount of time. If you do not set an expiration date and time, the file never expires. Because the link content can be cached, this content is still accessible after the expiration for a maximum of ten minutes. Likewise, if you delete a link and the link is cached, it remains available for a maximum of ten minutes.
Resource types
Every public link is associated with a resource type. This association allows the public endpoint to be configured to serve only two types of resources:
-
Content - for links generated by users.
-
Portal - for links generated by the system.
Force download
By default, a public link file is displayed in the browser if possible. However, some file types, such as ZIP files, cannot be displayed. These file types are automatically downloaded.
If you want public links to download automatically, you need to set the download
query parameter to true
, as shown in the following example.
https://{MY_SITE}/api/public/content/b2f7bfc7756b4e8891dd9ec54453024a?v=7dbfe11b&download=true
Transformations
You can apply conversions on public link images dynamically using transformations. Transformations are entities that represent a conversion configuration for the public links; this means that, once a transformation entity has been created, you can directly apply it on all public links without regenerating.
Transformations are identified by a name. You can use the name in a public link URL to tell the API that a transformation is required for this public link. For example, in the following link, https://<MY_MEDIA_DELIVERY>/api/public/content/<MY_PUBLIC_LINK>?t=myTransformation
, the t=myTransformation
parameter informs the public link API that you want to apply a transformation called myTransformation when serving the file. See Media transformations for examples of media transformation parameters.
You can also configure transformations on the Manage > Transformations page if you have the required permissions. For each transformation, you configure the name, width, height, and quality.
The transformed file is always in JPEG format.
Image merging
You can merge multiple public link images into one image using image merging. To do so, add the b parameter to the public link URL. For example, in the following link http://<MY_MEDIA_DELIVERY>/api/public/content/<MY_PUBLIC_LINK>?b=<MY_SECOND_PUBLIC_LINK>,<MY_THIRD_PUBLIC_LINK>
, the b=<MY_SECOND_PUBLIC_LINK>,<MY_THIRD_PUBLIC_LINK>
parameter initials the merge with the original public link (the background image) with two additional public links:
-
MY_SECOND_PUBLIC_LINK
-
MY_THIRD_PUBLIC_LINK
MY_SECOND_PUBICLINK
and MY_THIRD_PUBLIC_LINK
are the relative URLs of the public links. The b
parameter is a comma-separated list of relative public link URLs.
When you configure a conversion on a public link, the public link loses transparency because it is converted to a JPEG file. You must make sure the public links you want to use for merging are transparent.
You can merge up to five public links into the original one.
Conversion cache
The public links API caches conversions to avoid overloading the servers when too many conversion requests come in. Caching means storing the converted file in a temporary file provider.