Getting custom metadata by entry ID

Hey All,

I have a question that seems like it should have a simple answer, but I have yet to discover it by reading the API documentation and browsing the forums.

I have a custom metadata profile for Entries in my installation of Kaltura CE.

I can list the metadata easily enough using the metadata service, but what I can’t seem to figure out is how do I relate the metadata objects I get from the metadata service to actual entries?

The objectID member seems to be and ID specific to that metadata object, not the entry that it belongs to. Obviously the KMC does it. :slight_smile:

What am I missing here?

Hey Dave,

To learn how to work with the metadataProfile and metadata services, please see:
https://developer.kaltura.com/workflows/Enrich_and_Organize_Metadata/Working_with_metadata

This workflow covers adding a new metadata profile and adding and updating metadata for a given entry.
If you’re asking about how to obtain the metadata for a given entry ID, that’s done with metadata->list(), here is a basic code sample using the PHP client:

<?php
$filter = new KalturaMetadataFilter();
// if you want to retrieve results associated with a specific profile ID:
//$filter->metadataProfileIdEqual = 12;
$filter->metadataObjectTypeEqual = string::ENTRY;
$filter->objectIdEqual = '0_kgk0ef3j';
$pager = null;
$metadataPlugin = KalturaMetadataClientPlugin::get($client);
$result = $metadataPlugin->metadata->listAction($filter, $pager);

Since I happen to know you’re using the C# client, see sample code from the client’s unit tests here:

Note that you can also generate code for a given service.action in the developer.kaltura.com API console, for instance:
https://developer.kaltura.com/api-docs/Enrich_and_Organize_Metadata/metadata/metadata_list
Click on “Try it out”, then select/input the desired values and select “C#” on the right pane to generate the code.

Hey @jess

Thanks for the reply. The problem here was on my end. I had a bug in my code that made it look like there was no metadata for certain entries.

My code resembles the unit test as I did indeed use that as a model.

We’re good here :slight_smile: Thanks for the reply!