Associating Content w/ Categories

Hello,

I’m adding content programmatically via the Java API and that is working fine. What isn’t working is when I try to associate a Category using the KalturaMediaEntry.categoriesIds argument. Here’s the segment of code:
KalturaMediaEntry entry = new KalturaMediaEntry();
entry.mediaType = KalturaMediaType.VIDEO;
entry.name = “Name goes here=” + new Date();
entry.description = “Description goes here”;
entry.referenceId = uploadTokenId;
entry.categoriesIds=“74477371”;

		KalturaMediaEntry result = mediaClient.getKalturaClient().getMediaService().add(entry);

When I execute this code I always get the exception: ‘KalturaApiException: Category id “74477371” not found’

And yes, I’ve already created the Category via the KMC.

All help is appreciated.
F

Hi @garberfc,

What happens when you call category.get(74477371)?

When I do a KalturaMediaService.list(filter, pager) with a filter like:
KalturaMediaEntryFilter filter = new KalturaMediaEntryFilter();
filter.categoriesMatchOr = “74477371”;

I get a KalturaMediaListResponse object back with totalCount = 0;

Hi,

For filtering based on category ID you’d want categoriesIdsMatchOr, not categoriesMatchOr, unless your category NAME is “74477371”.
At any rate, let’s start by making sure 74477371 is a valid category ID that belongs to the partner in question, like I said, does category.get(74477371) return a category object?

Hi Jess,

I changed the filter to:
filter.categoriesIdsMatchOr = “74477371”;
and it had no affect (still no entries found).

What object do I call category.get(xxx) on?

F

Hi @jess,

I found the CategoryService().list method and called it with an ‘empty’ filter. I get the following response:
“Samples”, fullName=Samples, id=74225511
"Sample Images", fullName=Samples>Sample Images, id=74225521
"Sample Audio", fullName=Samples>Sample Audio, id=74225531
"Sample Videos", fullName=Samples>Sample Videos, id=74225541

These four categories are four out of roughly 20 categories that were created automatically for me when I started my trial with Kaltura.

Why would such a small subset be returned in the call? I don’t see anything special about them…

Thanks in advance,
F

Hi @garberfc,

Please see this thread:

Thanks @jess. I’m all set now :slight_smile:

Most welcome, Frank.
Cheers,