Get Content Metadata by Filename (REST)


The REST Web Service, located at /content_metadata_by_filename, can return the Content ID and other metadata for a file. The REST service results are limited to 1K in size. You can use the Content ID to delete the content via SOAP, for example.

Request URL



Parameter Type Required Max Length Description
filename String Y 128 The filename of the content file on the server. In the above example URL, Sample.m2p is the filename.

The filename can be determined by looking at the details page for any content.

Code Examples


This example uses PHP 5’s handy simplexml_load_file() function. This function converts the XML return into an ordinary PHP object. Change myserver and Sample.m2p accordingly:

< ?php
$xml = simplexml_load_file(
// print_r($xml); // Shows all properties of the object. Good for debugging.
// Access the XML elements like you normally access Properties of a PHP object:
echo($xml->{'actual-duration'}); // Enclose dashed Properties in {''}.
// ...and so on...

We recommend that you wrap the simplexml_load_file() call above in some additional error handling to gracefully trap cases when connectivity to the server is offline. The PHP documentation has a good example of this.



A typical return is in this example:

< ?xml version="1.0" encoding="UTF-8" ?>
<content -file>
  <!-- The actual duration of the content in microseconds. -->
  <actual -duration type="integer">30130</actual>
  <contributor nil="true"/> <!-- No contributor is listed. -->
  <!-- The date this file was imported onto the server. -->
  <created -at type="datetime">2009-07-29T13:09:47-04:00</created>
  <!-- The content is scheduled for deletion on December 31, 2009 at 6:00 PM.
       If the deletion date were blank, this line would read nil. -->
  <delete -datetime type="datetime">2009-12-31T18:00:00-05:00 </delete>
  <!-- The description used in the EPG. -->
  <description>Sample Content for TelVue</description>
  <duration type="integer">31</duration> <!-- Content’s runtime in secs. -->
  <!-- The episode name.  If the Episode field were blank, this would read episode
       nil= true. -->
  <!-- If this content had an episode code it would be displayed here. -->
  <episode -code nil="true" />
  <!-- The content’s actual filename -->
  <!-- This content’s ID is 152. Content IDs may range from 1 – 1000 or more. -->
  <id type="integer">152</id>
  <import_datetime type="datetime">2009-07-29T13:09:47-04:00</import_datetime>
  <!-- No location is listed. -->
  <location />
  <!-- The content’s name, as displayed at the top of the Edit Content and
       Show Content pages. -->
  <!-- The program name.  If the Program field were blank, this would read
       program nil= true. -->
  <program>Sample Content</program>
  <!-- If this content had a program code it would be displayed here. -->
  <program -code nil="true" />
  <categories type="array">
      <id type="integer">1</id> <!-- This content is in 1 category. -->
      <name>Community</name> <!-- This content is in the Community category. -->
  <!-- This content is on the server, rather than being unattached (TBD). -->

The program’s Content ID can be found in the “id” field in the response.


File not Found

< ?xml version="1.0" encoding="UTF-8"?>
  <error>Content with filename: Sample.m2p does not exist.</error>


  1. Kevin Reynen says:

    We’re having issues dealing with dash in content-file and actual-duration with PHP’s simplexml_load_file.

    According to I should be able to reference it using {‘ ‘} like $xml->{‘actual-duration’}, but that’s not working for us.

    Can you post an example of accessing this with simplexml_load_file?

  2. rbrooks says:

    Kevin, we’ve updated the article with a code example using simplexml_load_file(). It tested successfully on our end.

    HTH. Thanks!

  3. We were having the same problem as Kevin in #1. Using the updated example I used the curly braces around elements with “dashes” as suggested by Kevin and now it works. Unless I missed something, it looks like you need the {”} to make it work. You might want to update your example to include an element with a dash:

    echo($xml->{‘episode-code’}; //element with a dash needs curly braces
    // …and so on…

  4. rbrooks says:

    Code example updated accordingly. Thanks, Daniel!

    I found a post about this in the PHP docs too.