Skip to content

Predefined settings

Note

The concept of predefined settings have been replaced by transformation functions in DAM 24.

If you haven't already, read Creating a predefined setting on how to get started creating predefined settings.

Retrieving the transformed file via the UI

You can download a transformed file based on the predefined setting. To transform a file using the predefined setting do the following:

  1. Click on the file to see the file details, which also show the unique identifier (File ID) for the file.
    File details from DAM UI.
  2. Go to the 'Transformations' tab.
  3. Select the predefined setting 'Canvas 400x400' and click 'Download'.
    Transformation tab

Retrieving the transformed file via the API

Instead of using the UI for getting files with a certain transformation, using the API is more appropriate for a webshop integration. Let's use the API to retrieve a URL for the same image as before:

  1. Go to https://localhost:8012/swagger/index.html or where you might access the DAM API.
  2. Authorize
  3. Go to GET: /api/_/predefined-settings/by-name and send a request with the name of Canvas 400x400 and copy the id of the response.
  4. Go to POST: /api/{culture}/files/cache/details and send a request with the following body:

    1
    2
    3
    4
    5
    6
    7
    [
      {
        "transformation": "PredefinedSetting",
        "fileId": "ee357c6c-06c9-4de7-9988-be704f02ee59",
        "predefinedSettingId": "98600e8b-4049-49a9-b297-0ac33a140d8e"
      }
    ]
    

    Note

    Your fileId and predefinedSettingId will be different from the ones in the request above.

    Important

    If the predefined setting is not caching automatically or a request with a custom transformation is sent, the API will build the file during the request. This can lead to slow response times.

    You should get a fileUri which can be used to retrieve the file, alongside some meta information for the transformed file.

    [
      {
        "status": "Success",
        "cachedFileDetails": {
          "fileUri": "http://localhost:10000/devstoreaccount1/dam-cache/19/38/1d3a-dda8-4b58-9308-252c4e6f8486/eco-tote-bag-oyster-back-63e4a955b0025.png?v=638181930020000000",
          "fileName": "eco-tote-bag-oyster-back-63e4a955b0025.png",
          "height": 400,
          "width": 400,
          "cachedFileInfo": {
            "predefinedSettingId": "98600e8b-4049-49a9-b297-0ac33a140d8e",
            "fileId": "ee357c6c-06c9-4de7-9988-be704f02ee59",
            "croppingId": null,
            "imageType": null,
            "discriminator": "CachedFileInfoForPredefinedSetting"
          }
        }
      }
    ]
    

    Important

    Do not cache the fileUri for a long period since it can change.