Files - Import Local File

This guide explains how to import a local file in EnterMediaDB using:

  • JSON REST API
  • EnterMediaDB API UI

Both methods perform the same operation.


1. Overview

The Local File API allows you to create an asset in EnterMediaDB from:

  • a local file
  • a hot folder file
  • a Google Drive file
  • an Amazon S3 file

This process imports the file, creates a new asset, and generates metadata for the asset.


2. API Endpoint

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

Endpoint:

POST /mediadb/services/module/asset/create

This endpoint:

  • Creates a new asset
  • Generates metadata for the imported asset

3. Required Parameters

The following parameters must be included in the request body:

  • id: Unique string used to identify the asset
  • importpath: Path to the file being imported
  • keywords: Array of strings representing asset tags
  • longcaption: Caption or description for the asset
  • sourcepath (optional): Final folder location for the asset inside EnterMediaDB
  • rotate: Degrees to rotate the asset (e.g., 90, 180, 270)

These values specify which file to import and how the asset should be stored and categorized.


4. Import Local File Using JSON REST API

Step 1: Prepare Your Data

Example:

{
  "importpath": "/media/tempdata/york-360-orig.mp4",
  "sourcepath": "Clients/TEST11/${filename}",
  "keywords": [
    "animals",
    "bird"
  ],
  "longcaption": "TEST"
}

Step 2: Send the Request
curl -H "Content-Type: application/json" \
  -X POST http://entermedia.org/mediadb/services/module/asset/create \
  -b "entermedia.key=YOUR_SESSION_KEY" \
  -d '{
    "importpath": "/media/tempdata/york-360-orig.mp4",
    "sourcepath": "Clients/TEST11/${filename}",
    "keywords": [
      "animals",
      "bird"
    ],
    "longcaption": "TEST"
  }'
Notes
  • Replace YOUR_SESSION_KEY with your actual entermedia.key
  • Ensure your API session is initialized (see Authentication section)
  • Use a hot folder path if you want EnterMediaDB to use the original file directly
  • Use a local file path if you want EnterMediaDB to create a copy of the file
  • Use -L if your server redirects to HTTPS

5. Import Local File Using EnterMediaDB API UI

You can import a local file directly in the EnterMediaDB interface.

Steps
  1. Open the EnterMediaDB API UI

    Example:
    https://emedialibrary.org/mediadb

  2. In the left sidebar, navigate to:
    FilesImport Local File

  3. In the request editor, enter:

 {
  "id": "101",
  "importpath": "/mnt/Marketing/somefile.mov",
  "assettype": "article",
  "keywords": [
    "animals",
    "bird"
  ],
  "longcaption": "TEST",
  "creator": {
    "id": "billmoyers1",
    "firstname": "Bill",
    "lastname": "Moyers"
  },
  "editstatus": 6
}

4. Click Execute


6. Response

A successful request returns:

{
  "response": {
    "status": "ok",
    "id": "101"
  },
  "data": {
    "id": "101",
    "name": "cover2.jpg",
    "sourcepath": "MediaCenter/cover2.jpg",
    "assettype": {
      "id": "article",
      "name": ""
    },
    "longcaption": "TEST",
    "keywords": [
      {
        "id": "animals",
        "name": ""
      },
      {
        "id": "bird",
        "name": ""
      }
    ]
  }
}

7. What Happens After Import

After a successful request:

  • A new asset is created in EnterMediaDB
  • The file is imported into the system
  • Metadata is automatically generated
  • Keywords and captions are attached to the asset
  • The asset becomes available for:
    • search
    • preview
    • download
    • conversion

8. Troubleshooting

1. Import fails
  • Check that importpath is valid
  • Ensure the file exists and is accessible
  • Verify API permissions are enabled

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

3. No visible change
  • Refresh the interface
  • Verify sourcepath is correct
  • Check whether the asset finished importing
4. File copied instead of referenced
  • Use a hot folder path if you want the original file to remain linked
  • Use a local path if you want EnterMediaDB to create a copy of the file