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:
orConditionsis a list of groups. An entry is listed if it matches any group.- Each group's
andConditionsis 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
type | Fields | Matches entries that… |
|---|---|---|
byMediaType | mediaTypesList: string[] | Have any of these KalturaMediaType values: '1' video, '2' image, '5' audio. |
byUser | userIds: string[], roles?: string[] | Have any of these users in any of these roles. See the roles below. |
byCategory | categoryIds: string[], matchDescendants?: boolean, exclude?: boolean | Are in any of these categories. matchDescendants: true also matches their subcategories. exclude: true instead lists entries not in them. |
byObjectStatus | statusList: string[] | Have any of these KalturaEntryStatus values, for example '2' ready. |
byESearchObjects | filter: { objectType, ... } | Match a raw eSearch item you provide, such as KalturaESearchEntryItem. Use it for fields the other conditions don't cover. |
byUser Roles
| Role | Matches entries the user… |
|---|---|
owner (default) | Owns |
creator | Created |
coEditor | Can edit as a co-editor |
coPublisher | Can publish as a co-publisher |
coViewer | Can 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
typeorbyUserrole. - A field of the wrong shape, for example a string where an array is expected, or
exclude: 'false'instead offalse. - A
byESearchObjects.filterwithout a stringobjectType.
A group that ends up empty is dropped rather than treated as "match everything".
Order of Operations
For each list request:
- The table builds its query from the context, media-type filter and search box.
apiFilters.getMediaListnarrows it.- The
preGetMediaListinterceptor, if any, sees the result and can change it further.