Skip to main content
View as Markdown

API Filters - Media Manager

API Filters​

apiFilters.getMediaList narrows the media list with declarative conditions, such as "videos owned by Jane" or "entries in these categories". It only narrows: it is applied on top of the context, media-type and search filters, and never shows more than they allow.

settings: {
context: {
type: 'myMedia',
apiFilters: {
getMediaList: {
orConditions: [
{
andConditions: [
{ type: 'byMediaType', mediaTypesList: ['1'] },
{ type: 'byUser', userIds: ['jane@example.com'] },
],
},
],
},
},
},
}

How Conditions Combine​

The filter is an OR of ANDs:

  • orConditions is a list of groups. An entry is listed if it matches any group.
  • Each group's andConditions is a list of conditions. An entry matches the group only if it matches all of them.

So this lists videos owned by Jane, or anything in category 12345:

getMediaList: {
orConditions: [
{ andConditions: [
{ type: 'byMediaType', mediaTypesList: ['1'] },
{ type: 'byUser', userIds: ['jane@example.com'] },
] },
{ andConditions: [
{ type: 'byCategory', categoryIds: ['12345'] },
] },
],
}

Conditions​

typeFieldsMatches entries that…
byMediaTypemediaTypesList: string[]Have any of these KalturaMediaType values: '1' video, '2' image, '5' audio.
byUseruserIds: string[], roles?: string[]Have any of these users in any of these roles. See the roles below.
byCategorycategoryIds: string[], matchDescendants?: boolean, exclude?: booleanAre in any of these categories. matchDescendants: true also matches their subcategories. exclude: true instead lists entries not in them.
byObjectStatusstatusList: string[]Have any of these KalturaEntryStatus values, for example '2' ready.
byESearchObjectsfilter: { objectType, ... }Match a raw eSearch item you provide, such as KalturaESearchEntryItem. Use it for fields the other conditions don't cover.

byUser Roles​

RoleMatches entries the user…
owner (default)Owns
creatorCreated
coEditorCan edit as a co-editor
coPublisherCan publish as a co-publisher
coViewerCan view as a co-viewer

With several roles, an entry matches if the user has any of them:

{ type: 'byUser', userIds: ['jane@example.com'], roles: ['owner', 'coEditor'] }

To include a user's groups, add the group IDs to userIds.

byObjectStatus Applies to the Whole List​

Entry status isn't a per-group field in eSearch, so the statuses from every byObjectStatus condition are combined and applied to the whole list. They can only narrow the statuses the table already lists, which include ready, processing, pending and failed entries. To list other statuses, use the preGetMediaList interceptor.

byESearchObjects​

Pass any eSearch item as a plain object, with its objectType:

{
type: 'byESearchObjects',
filter: {
objectType: 'KalturaESearchEntryItem',
fieldName: 'tags',
searchTerm: 'approved',
itemType: 1,
},
}

itemType is 1 for an exact match and 2 for a partial match. See the eSearch API for fields and item types.

Mistakes Fail Loudly​

Unlike interceptors, API filters fail closed. A malformed filter never silently widens the list; instead the list shows an error, and the console logs a message starting with apiFilters.getMediaList: that says what is wrong. This happens for:

  • An unknown condition type or byUser role.
  • A field of the wrong shape, for example a string where an array is expected, or exclude: 'false' instead of false.
  • A byESearchObjects.filter without a string objectType.

A group that ends up empty is dropped rather than treated as "match everything".

Order of Operations​

For each list request:

  1. The table builds its query from the context, media-type filter and search box.
  2. apiFilters.getMediaList narrows it.
  3. The preGetMediaList interceptor, if any, sees the result and can change it further.