DAM API for friendly URLs

This section describes the DAM API that allows you to create a friendly URL for an asset.

  • To set friendly URLs, assets must always have a unique name in a collection.
  • You cannot upload an asset with a file name that already exists in a collection; doing so returns an error message that says you must update the file name and try uploading again.
  • For existing assets that have duplicate names in a collection, you must rename these assets so you can set friendly URLs.
  • You can provide a unique name whenever you save the asset as new.

What is a friendly URL?

A friendly URL makes a web address easy-to-read by using words to describe the content, making it easier to remember. With the DAM API, you can set a friendly URL.

In contrast, a binaryUrl you get from Copy link on the Edit page, consists of a string of characters representing the collection_id, item_id, and rendition_id.

Figure 1. Copy link from the Edit page
Sample binaryUrl:
Meanwhile, a customUrl provides the original rendition of an asset. The customUrl is not related to a friendly URL.
Figure 2. Custom URL field from the Edit page
Sample customUrl:

Using the DAM API explorer, you can set a friendly URL for each asset, individually.

You can get the content of an asset by choosing a specific property such as:
  • The item_id, file name, or custom URL of an asset.
  • The rendition_id or the rendition type.
  • The version number for each version of a rendition.
Here is a DAM API URL with an item ID, rendition ID, and version ID:
With a friendly URL for the asset file name, rendition name, and version number, the DAM API URL looks like this:

How to set a friendly URL for an asset using DAM API explorer

Before doing the steps in this section, you must have the following information from the asset:
  • The collection_id where the asset is located (required).
  • The item_id of the asset to set the friendly URL for (required).
  • The rendition_id for the asset rendition (required, as applicable).
  1. Open the DAM API explorer.
  2. From the CollectionController or RenditionController, select the API to use and provide the collection_id, item_id, or rendition_id.
    • For the collection ID field, you can only use the collection_id.
    • For the media asset ID field, you can use the item_id or the file name of a specified media file.
    • For the rendition ID field, you can use the rendition_id or the rendition type.
  3. Click Execute to run the API.
  4. Check the request API URL looks similar to the following:
  5. In the response data, check that the binary, thumbnail, and self URLs have friendly URLs similar to the following:
    • binaryUrl: /collections/4400-45a1-46b2-47c3/items/car.jpg/renditions/Desktop?binary=true.
    • thumbnailUrl: /collections/4400-45a1-46b2-47c3/items/car.jpg/renditions/Desktop?thumbnail=true.
    • self: /collections/4400-45a1-46b2-47c3/items/car.jpg/renditions/Desktop.

How to change duplicate asset names using DAM

If an asset happens to have the same name with another asset in a collection, a notification is displayed in the Information panel.
Figure 3. Notification to rename an asset
You can click Rename from the notification and provide a unique name.
Figure 4. Rename asset dialog