Asset Media - Run A Conversion

This guide explains how to run a preset conversion on an asset using:

  • JSON REST API
  • EnterMediaDB API UI

Both methods perform the same operation.


1. Overview

A conversion applies a predefined preset (such as a preview or thumbnail) to an asset.

This process generates a new file based on the selected preset.


2. API Endpoint

The API endpoint is the URL used to run this operation via the REST API.

Endpoint:

POST /assets/mediadb/services/module/asset/media/convertasset

This endpoint:

  • Processes a conversion request
  • Applies the specified preset to the given asset

3. Required Parameters

The following parameters must be included in the request body:

  • assetid: ID of the asset to convert
  • presetid: ID of the conversion preset

These values specify which asset to process and which conversion to run.


4. Run Conversion Using JSON REST API

Step 1: Prepare Your Data

Example:

{
  "assetid": "AZ2sit9YltjsdT37Qojd",
  "presetid": "webpthumbimage"
}

Step 2: Send the Request

curl -H "Content-Type: application/json" \
  -X POST http://entermedia.org/assets/mediadb/services/module/asset/media/convertasset \
  -b "entermedia.key=YOUR_SESSION_KEY" \
  -d '{
    "assetid": "AZ2sit9YltjsdT37Qojd",
    "presetid": "webpthumbimage"
  }'


Notes
  • Replace YOUR_SESSION_KEY with your actual entermedia.key
  • Ensure your API session is initialized (see Authentication section)
  • Use -L if your server redirects to HTTPS

5. Run Conversion Using EnterMediaDB API UI

You can run the same conversion directly in the EnterMediaDB interface.

Steps
  1. Open the EntermediaDB API UI

    Example:
    https://emedialibrary.org/mediadb

  2. In the left sidebar, navigate to:
    Asset Media → Run a Conversion

  3. In the request editor, enter:
{
  "assetid": "AZ2sit9YltjsdT37Qojd",
  "presetid": "webpthumbimage"
}
 
  1. Click Execute

6. Response

A successful request returns:

{
  "response": {
    "status": "ok"
  },
  "results": {
    "path": "/assets/mediadb/services/module/asset/downloads/generated/..."
  }
}
 

7. Accessing the Converted File

The results.path value provides the location of the generated file.

You can use this path to:

  • Download the converted asset
  • Display it in your application
  • Use it in workflows

8. Troubleshooting

1. Conversion fails
  • Check that assetid is valid
  • Ensure presetid exists
  • Verify API permissions are enabled

2. Unauthorized request
  • Ensure entermedia.key is included
  • Ensure session is initialized
  • Verify permissions

3. Nothing happens in UI
  • Check JSON format
  • Confirm correct module is selected
  • Try reloading modules if needed