Get thumbnail by reference id possible?


#1

Hiya

Is it possible to grab a thumbnail using a reference ID instead of an entry ID?
eg of entry ID method:
<img src="http://kaltura.scarlettentertainment.com/p/102/thumbnail/entry_id/0_8ka0fmvu/width/643/height/160/type/1/quality/100/" height="156" width="237">

This will be quite helpful for a smoother migration.

If it’s not possible I can do it via the api using something like the code below and grabbing the entry id first:
$result = $client->baseentry->listByReferenceId($refId, $pager);

Thanks in advance.


#2

Hello @michael_hall,

You need to pass the entry ID to the thumbnail API.
Calling baseentry->listByReferenceId() is indeed one way to do it, if you’re running the Kaltura Server latest version [14.15.0], you may also use the eSearch service for that. Below are examples using the PHP client lib as well as curl CLI:

PHP:

<?php
  $elasticSearchPlugin = KalturaElasticSearchClientPlugin::get($client);
  $searchParams = new KalturaESearchEntryParams();
  $searchParams->searchOperator = new KalturaESearchEntryOperator();
  $searchParams->searchOperator->operator = KalturaESearchOperatorType::OR_OP;
  $searchParams->searchOperator->searchItems = [];
  $searchParams->searchOperator->searchItems[0] = new KalturaESearchEntryItem();
  $searchParams->searchOperator->searchItems[0]->fieldName = KalturaESearchEntryFieldName::REFERENCE_ID;
  $searchParams->searchOperator->searchItems[0]->itemType = KalturaESearchItemType::EXACT_MATCH;
  $searchParams->searchOperator->searchItems[0]->searchTerm = $entry_ref_id;
  $pager = new KalturaPager();

  try {
    $result = $elasticSearchPlugin->eSearch->searchEntry($searchParams, $pager);
    var_dump($result);
  } catch (Exception $e) {
    echo $e->getMessage();
  }
?>

cURL CLI:

curl -X POST https://www.kaltura.com/api_v3/service/elasticsearch_esearch/action/searchEntry \
    -d "ks=$KALTURA_SESSION" \
    -d "searchParams[searchOperator][operator]=2" \
    -d "searchParams[searchOperator][searchItems][0][objectType]=KalturaESearchEntryItem" \
    -d "searchParams[searchOperator][searchItems][0][fieldName]=reference_id" \
    -d "searchParams[searchOperator][searchItems][0][itemType]=1" \
    -d "searchParams[searchOperator][searchItems][0][searchTerm]=$ENTRY_REF_ID" \
    -d "searchParams[searchOperator][objectType]=KalturaESearchEntryOperator" \
    -d "searchParams[objectType]=KalturaESearchEntryParams"

Cheers,


#3

Hi Jess

Thanks for this. I managed to get it working with $result = $client->baseEntry->listByReferenceId($refId, $pager);

I will try the eSearch version as well as it seems like it could be more flexible for me in the future.