Distribution - Search Distribution

This guide explains how to search for distribution links in EnterMediaDB using:

  • JSON REST API
  • EnterMediaDB API UI

Both methods perform the same operation.


1. Overview

The Search Distribution API allows you to search for distribution entries that match a query.

This process returns a list of matching distribution links and their associated assets.


2. API Endpoint

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

Endpoint:

POST /assets/mediadb/services/distribution/search/search

This endpoint:

  • Processes a distribution search request
  • Returns matching distribution entries based on the query

3. Required Parameters

The following parameters must be included in the request body:

  • page: Page number of results to return
  • hitsperpage: Number of results per page
  • query: Search criteria used to filter results
  • value: Search value used in the query

These values specify which distribution entries to return and how to filter them.


4. Search Distribution Using JSON REST API

Step 1: Prepare Your Data

Example:

{
  "page": "1",
  "hitsperpage": "20",
  "query": {
    "terms": [
      {
        "field": "id",
        "operator": "matches",
        "value": "*"
      }
    ]
  }
}

Step 2: Send the Request
curl -H "Content-Type: application/json" \
  -X POST http://entermedia.org/assets/mediadb/services/distribution/search/search \
  -b "entermedia.key=YOUR_SESSION_KEY" \
  -d '{
    "page": "1",
    "hitsperpage": "20",
    "query": {
      "terms": [
        {
          "field": "id",
          "operator": "matches",
          "value": "*"
        }
      ]
    }
  }'
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
  • Requests must be in JSON format

5. Search Distribution Using EnterMediaDB API UI

You can search for distribution entries directly in the EnterMediaDB interface.

Steps
  1. Open the EnterMediaDB API UI

    Example:
    https://emedialibrary.org/mediadb

  2. In the left sidebar, navigate to:
     DistributionSearch distribution

  3. In the request editor, enter:

{
  "page": "1",
  "hitsperpage": "20",
  "query": {
    "terms": [
      {
        "field": "id",
        "operator": "matches",
        "value": "AXW9fj8jvGxYDEkmaFkV"
      }
    ]
  }
}

4. Click Execute


6. Response

A successful request returns:

{
  "response": {
    "status": "ok",
    "totalhits": 1,
    "searchtype": "distribution",
    "hitsperpage": 20,
    "page": 1,
    "pages": 1,
    "hitsessionid": "hitsdistributionassets/catalog",
    "query": {
      "friendly": "GUID:*",
      "search": "id:(*)"
    }
  },
  "results": [
    {
      "id": "93caa502-139a-40c3-accb-5891076bb04a",
      "assetid": {
        "id": "101",
        "name": ""
      }
    }
  ]
}

8. Accessing Search Results

The results field contains matching distribution entries.

Each result may include:

  • Distribution ID
  • Associated asset ID
  • Search metadata

These results can be used to:

  • Locate distribution links
  • Retrieve associated assets
  • Edit or delete distributions

9. Troubleshooting

1. No results returned
  • Check query conditions
  • Ensure distribution entries exist
  • Verify user permissions

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

3. Invalid JSON request
  • Check JSON formatting
  • Ensure required fields are included