Dependent Multirequest Question

Hi,

I have a list action request for fetching media entries. I’d like to get back the metadata for each of the entries returned. I’d like to use a multirequest so I can get back all the data in one response.

For the second request, I set the objectIdIn to {1:result:objects:0:id}.

However, this just gets back the metadata for the first entry returned in the first request since it uses 0 for the index.

Is there a way to get back all of the metadata for all of the entries returned in the first request?

Is there an index value, a kind of wildcard, I can use to indicate I want the metadata back for each of the entries?

I found what I need to do is to create a loop where I add multiple requests that match up to the results in the first list request. Here is an example in PHP below using the PHP5 SDK. Note how I substitute the index into the objectIdIn string.

One complication is that you may add more requests than there are results in the list request, so be sure to check for that in the returned objects.

function k_list_media(&$client, $page_size, $page_index) { 
    $list_filter = new KalturaMediaEntryFilter();
    $list_pager = new KalturaFilterPager();

    $list_pager->pageSize = $page_size; 
    $list_pager->pageIndex = $page_index; 

    $client->startMultiRequest();  

    $client->media->listAction($list_filter, $list_pager);

    // Add metadata requests for each of the media requests.
    for($i = 0; $i < $page_size; $i++)
    {    
        $metadata_filter = new KalturaMetadataFilter();      
        $metadata_filter->objectIdIn = "{1:result:objects:{$i}:id}";

        $client->metadata->listAction($metadata_filter);
    }