Media.list API gives unexpected results

Hi all,

I’m currently a little confused - I think I might have the wrong expectations of how the Media.list API works, but having reviewed the documentation I can’t find anything to contradict my assumptions. Quite simply, I have some video content, of which one is tagged TUM1001.1.

When I use the service/tagsearch_tag/action/search for TUM1001.1, it confirms there is "instanceCount": 1 of this particular tag.

However, when I use the service/media/action/list API with a filter of "filter[tagsLike]=TUM1001.1", it returns two entries, tagged as follows:

Entry 1:
“tags”: “tum1005.1, tum1001.7, tum1002.7”

Entry 2:
“tags”: “tum1001.1, tum1002.1”

I would expect that only Entry 2 is returned.

Can anyone please advise?

Thanks

1 Like

Hello @sjwarner,

The media.list() and tagsearch.search() actions will indeed behave as you described. However, you may use the eSearch.searchEntry() action to accomplish your goal.

curl CLI:

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

Here’s another example, this time using the Ruby API client:

search_params = KalturaESearchEntryParams.new()
search_params.search_operator = KalturaESearchEntryOperator.new()
search_params.search_operator.operator = KalturaESearchOperatorType::AND_OP
search_params.search_operator.search_items = []
search_params.search_operator.search_items[0] = KalturaESearchEntryItem.new()
search_params.search_operator.search_items[0].field_name = KalturaESearchEntryFieldName::TAGS
search_params.search_operator.search_items[0].item_type = KalturaESearchItemType::EXACT_MATCH
search_params.search_operator.search_items[0].search_term = "TUM1001.1"
pager = KalturaPager.new()

results = client.e_search_service.search_entry(search_params, pager)
puts results.inspect

You can test this action (and any other action for that matter) using our interactive console:
https://developer.kaltura.com/console/service/eSearch/action/searchEntry?query=esearch.search

The interface also includes a code generator that can produce ready to use code for all supported API clients.

Cheers,

Thanks for the info :astonished: