Distribution - Create a New Distribution
This guide explains how to create a distribution link for an asset in EnterMediaDB using:
- JSON REST API
- EnterMediaDB API UI
Both methods perform the same operation.
1. Overview
The Create Distribution API allows you to generate a distribution link for an asset.
This process creates a public or shareable distribution URL that can be used to access the asset externally.
2. API Endpoint
The API endpoint is the URL used to run this operation via the REST API.
Endpoint:
POST /assets/mediadb/services/distribution/create/createThis endpoint:
- Creates a new distribution request
- Generates distribution URLs for the specified asset
3. Required Parameters
The following parameters must be included in the request body:
- assetid: (required) ID of the asset to distribute
- id: (optional) Custom distribution ID used in the generated URL
These values specify which asset to distribute and optionally define the distribution identifier.
4. Create Distribution Using JSON REST API
Step 1: Prepare Your Data
Example:
{
"assetid": "101",
"id": "93caa502-139a-40c3-accb-5891076bb04a"
}Step 2: Send the Request
curl -H "Content-Type: application/json" \
-X POST http://entermedia.org/assets/mediadb/services/distribution/create/create \
-b "entermedia.key=YOUR_SESSION_KEY" \
-d '{
"assetid": "101",
"id": "93caa502-139a-40c3-accb-5891076bb04a"
}'Notes
- Replace
YOUR_SESSION_KEYwith your actualentermedia.key - Ensure your API session is initialized (see Authentication section)
- Use
-Lif your server redirects to HTTPS - If no id is provided, EnterMediaDB may generate one automatically
5. Create Distribution Using EnterMediaDB API UI
You can create a distribution link directly in the EnterMediaDB interface.
Steps
Open the EnterMediaDB API UI
In the left sidebar, navigate to:
Distribution → Create a new distribution
In the request editor, enter:
{
"assetid": "12345"
}4. Click Execute
6. Response
A successful request returns:
{
"response": {
"id": "93caa502-139a-40c3-accb-5891076bb04a",
"status": "ok"
},
"data": {
"id": "93caa502-139a-40c3-accb-5891076bb04a",
"assetid": {
"id": "101",
"name": ""
}
},
"urls": {
"baseurl": "http://em10.entermediadb.net/assets/mediadb/services/distribution/published/93caa502-139a-40c3-accb-5891076bb04a/",
"largeimage": "http://em10.entermediadb.net/assets/mediadb/services/distribution/published/93caa502-139a-40c3-accb-5891076bb04a/largeimage"
}
}7. Accessing Distribution Links
The response includes generated distribution URLs.
Common URLs include:
- baseurl: Base distribution URL for the asset
- largeimage: URL to a large preview image
These URLs can be used to:
- Share assets externally
- Embed assets in applications or websites
- Provide downloadable access to media
8. What Happens After Distribution Creation
After a successful request:
- A distribution entry is created
- Public distribution URLs are generated
- The asset becomes accessible through the generated distribution links
9. Troubleshooting
1. Distribution creation fails
- Check that
assetidis valid - Ensure the asset exists
- Verify API permissions are enabled
2. Unauthorized request
- Ensure
entermedia.keyis included - Ensure session is initialized
- Verify permissions
3. Distribution URL does not work
- Verify the distribution was created successfully
- Check whether the asset still exists
- Ensure the distribution service is enabled on the server