Metadata.update Documentation

Discussion for metadata.update documentation

I keep getting errors like this:
invalid metadata data: Element ‘PresentationDate’: This element is not expected. at line 4 [ 1498536000]

I have mutliple metadata profiles tied to entries, it looks to be trying to update the unintended one where that custom field doesn’t exist, hence the error. How do I target the intended metadata profile? I don’t see any kind of profile id parameter with update, like there is with metadata.list (using a filter). Oddly enough, there are some entries this metadata.update works for.

Thanks for any insight.

Hello @ayazasif,

When you say “I keep getting errors like this”, where exactly are you getting them? as in, what action triggers them? is this your own custom code or one of the Kaltura interfaces? if your own code, please attach it here, otherwise, please explain exactly what actions are taken to produce the error. Also, is this our SaaS ENV or a self hosted ENV? If self hosted, what version and what errors/exceptions do you see in /opt/kaltura/log/kaltura_api_v3.log?

A general explanation about the metadata services and how to use the different APIs is available here:

and includes a link to a step by step tutorial.

Hi - Thanks for the reply @jess . This is SaaS environment. Here’s the code producing the error:

<?php
  require_once('lib/KalturaClient.php');

  $config = new KalturaConfiguration(partner_id);
  $config->serviceUrl = 'https://www.kaltura.com';

  $client = new KalturaClient($config);
  $ks = $client->session->start(
    "admin_secret",
    "username",
    KalturaSessionType::ADMIN,
    partner_id);
  $client->setKS($ks);


  $id = 00000000; //object id of entry  (not the entryid)
  $xmlData = "<metadata>
  <DepartmentName>Other</DepartmentName>
  <Contact>John Doe</Contact>
  <PresentationDate>1498536000</PresentationDate>
  <PresenterName></PresenterName>
  <Location>NH, USA</Location>
  </metadata>";
  $version = 1;

  try {
    $result = $client->metadata->update($id, $xmlData, $version);
    var_dump($result);
  } catch (Exception $e) {
    echo $e->getMessage();
  }
  
?>

Hi @ayazasif,

Please send me a private message with the $id you’re passing to metadata->update().

@jess - Doesn’t look like I can PM yet. It’s 375367551

Hi @ayazasif,

That’s not the correct metadata ID:) Sent you a private message with more details.