Public links
On the Asset details page of Sitecore Content Hub, you can make renditions public. This means that, unlike all other files, the file is accessible under 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/{apiVersion}/{tenantId}/{resourceType}/{relativeurl}{?download,t,b}
You do not need to send 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.
These parameters are automatically generated by the AssetExtensionDataMessageHandler.
Name | Description | Mandatory |
---|---|---|
tenantId | Identifies the tenant that made the request. | Yes |
resourceType | Parameter used by the satellite. | Yes |
relativeurl | Parameter used by the satellite. | Yes |
t | Transformation parameter. | No |
b | Image merging parameter. | No |
Expiration date and time
You can configure the link to expire after a certain amount of time. If you do not set an expiration date and time, the file never expires. However, because the link content can be cached, this content can still be accessible after the expiration for a maximum of ten minutes.
The same happens if you delete a link. If cached, the link remains available for a maximum of ten minutes.
Resource types
Every public link is automatically associated with a resource type. This association allows the public endpoint to be configured to serve only two types of resources for more flexibility:
- 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 it is possible. However, you cannot display some file types like ZIP files in the browser. These file types are automatically downloaded.
If you want public links to download automatically, you need to set the download
query parameter to true
.
For example:
https://mysite/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 any need for regeneration.
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://MyMediaDelivery/api/public/content/myPublicLink?t=myTransformation
the part t=mytransformation
informs the public link API that we want to apply a transformation called myTransformation when serving the file.
You can configure transformations on the Transformations page which you access from the Manage page. For each of them, you can configure:
- Name
- Width
- Height
- Quality
The transformed file is always in jpeg
format.
Image merging
You can merge multiple public link images into one using public links image merging. To use the public links image merging, add the b
parameter to the public link URL.
For example, in the following link http://MyMediaDelivery/api/public/content/myPublicLink?b=mySecondPublicLink,myThirdPublicLink
, the b=mySecondPublicLink,myThirdPublicLink
parameter requests merging the original public link (the background image) with two additional public links:
mySecondPublicLink
myThirdPublicLink
mySecondPublicLink
and myThirdPublicLink
are the relative URLs of the public links.
The b
parameter is a comma-separated list of public links relative URLs.
If 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.