Is there a get for media by ReferenceID

I can see from the docs that there is a service “media” with and action “get” which requires the ENTRY_ID, is there a way of doing the same thing with the Reference ID ? I.e I want to get stream and download links of my asset but using the reference ID … is this possible ?

Hello,

Yes, it is.
You need to call
media.list()
using the KalturaMediaEntryFilter filter with referenceIdEqual,

Hi Jess,

Thanks , so it should be something like (For Nodejs) :

var filter = new KalturaMediaEntryFilter();
    filter.referenceIdEqual = "111111";
    var pager = null;
    var cb = function(success, results) {
    if(!success) {
        console.log(results);
    }
    if(results.code && results.message) {
        console.log(results.message);
        return;
    }
};
var result = client.media.list(cb, filter, pager);

Yes, that is correct.

I am getting

var filter = new KalturaMediaEntryFilter();

ReferenceError: KalturaMediaEntryFilter is not defined

I can see it’s definition in KalturaV0.js

/usr/local/lib/node_modules/kaltura/KalturaVO.js:function KalturaMediaEntryFilter(){

Also:
https://github.com/kaltura/KalturaGeneratedAPIClientsNodeJS/blob/master/KalturaVO.js#L3326

Yeah, for some reason the module is not being exported with my setup.

I had to use

 var Kaltura =  require('Kaltura/KalturaClient'); 

To get the client working, trying to work out why the KalturaMediaEntryFilter is not available …

There is something broken in this module, will try work it out … but just so you know …

Same result … undefined

I can see the object in the Client Object … there must be something wrong with the way the module export is being done ?
Do you need to define a module.exports = { } before populating … I am not a node expert, in the past I always have used

module.exports = {

    add: function(x, y, z) {
    },
    remove: function(x,y,z) {
    }

}

etc …

var type = require(‘kaltura/KalturaVO’);
var filter = new type.KalturaMediaEntryFilter();
var pager = new type.KalturaFilterPager();
//var filter = new Filter();
filter.referenceIdEqual = “11111”;

var res = client.media.list(mycb, filter, pager)

Now getting client.media.list is not a function

Hi,

Where do you instantiate the client? do not see it in the code you pasted…

I can see a “listAction” defined, not a list … my client seems ok from the object dump.
When I use client.media.listAction

var client = new Kaltura.KalturaClient(config);    client.session.start(function(ks) {
if (ks.code && ks.message) {
            console.log('Error starting session', success, ks);
        } else {
            client.setKs(ks);
            console.log("Success: " + require('util').inspect(client, false, null));
        }
    }, "xxxxxxxxxxxx",
    "yyyy@vvvvv.com",
    Kaltura.enums.KalturaSessionType.ADMIN,
    0000000);

Hello,

Yes, this is due to:


It was done so because ‘list’ is a preserved word in PHP, in JS, it actually isn’t but that is the origin of the issue.
Please use listAction()

Thanks,

Thanks, I have tried using listAction, but i can’t get any response other than undefined …

  var mycb = function(success, results) {
    if(!success) {
        console.log("failed:" + results);
    } else {
        console.log("passed:" + results);
    }

};
var res = client.media.listAction(mycb, filter, pager);

The callback gets a “success” but the result is undefined , so the output reads
passed: undefined

this is the actual request being sent with some signatures changed etc …

POST //api_v3/index.php?service=media&action=list&undefined HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Content-Length: 349
Host: www.kaltura.com
Connection: close

format=1&apiVersion=3.3.0&clientTag=node%315-10-2&filter:objectType=KalturaMediaEntryFilter&filter:referenceIdEqual=3142&pager:objectType=KalturaFilterPager&ks=djJ8MTc3NjI2MXwNOWkC9FHKp_c63YyqBvLbk8CuRDu9MtR16i1titOBkP2WUSgi42xj00EX84_uqZIJNX-uKiQ_yTN3khSis5PQtVWYCXtEjGFBE1JsPJ0dB2A%3D&kalsig=d080dd2a477493e38be72f76509a

Actually in the RAW HTTP Log I can see the data …

Please share the full code so I can help you further.

In the callback function the results are not set , but the data comes back in the first success parameter

It took a lot of reverse engineering to get this to work. Firstly the way the module exports work and then the way in which the data is handled compared to how it is documented. I think these should be fixed :wink: