Kaltura API - Problem retrieving all videos in my account

Hello -

I’m trying to retrieve all videos from my account using media.list, but the API is only returning videos owned by my user. After some investigation, I believe the problem lies in how I’m generating the ks and its admin privileges, as I tried the same script using the ks generated in the KMC and it worked.

I set up the session as follows:

var PARTNER_ID = 1234;
var USER_ID = 'me@domain.com';
var SECRET = '123456';

var config = new KalturaConfiguration(PARTNER_ID);
var client = new KalturaClient(config);

client.session.start(function(success, ks) {
    // ... store the client ...
}, SECRET, USER_ID, KalturaSessionType.ADMIN, PARTNER_ID);

Later on, I try to retrieve all the videos on my account (including by other users).

var filter = new KalturaMediaEntryFilter();
var pager = new KalturaFilterPager();

client.media.listAction(function(success, results) {
    // ... handle results ...
}, filter, pager);

However, it only returns the videos owned by my user (USER_ID). How can I retrieve all videos instead?

Thank you.

Hello,

Pass null as user ID when calling session.start()

Also, to decode a KS, which could have helped you here, go to Admin Console->Developer->System Helper
Check “KS” and in the “String to manipulate:” input yours.

If you are working with Kaltura’s SaaS, you will not have access to the admin console but you can use the Kaltura CLI client lib by downloading:
http://cdnbakmi.kaltura.com/content/clientlibs/cli_14-05-2015.tar.gz4

and following instructions in the README.
You will then be able to run:

# extks YOURKS

and get something like:

partner_id
partner_pattern
valid_until 1465050899 = 2016-06-04 15:34:59 (will expire in 23 hours and 59 minutes)
type 2
rand 1464964499.4276
user admin
privileges disableentitlement
master_partner_id
additional_data```

Thank you, @jess!

Your suggestion, combined with adding the disableentitlement privilege, solved the problem.

client.session.start(function(success, ks) {
    // ... store the client ...
}, SECRET, null, KalturaSessionType.ADMIN, PARTNER_ID, null, 'disableentitlement');

I have the same problem that Gabriel had and so I decided to follow this solution. The problem is that, when I set my “user_Id = None” since I am writing my program in python, I end up getting about 900 videos which are certainly not from my media. How can I get only the videos in my media. (both owned by me and not owned by me for a total of about 35 videos)

from KalturaClient import *
from KalturaClient.Plugins.Core import *

config = KalturaConfiguration()
client = KalturaClient(config)

#for privacy, I kept my id and secret keys private.

ks = client.session.start (
    secret = admin_secret,
    userId = None,
    type = KalturaSessionType.USER,
    partnerId = partner_secret, 
    expiry = 86400,
    privileges = 'disableentitlement' )

client.setKs(ks)
print(ks)

Hi @rasiamah ,

Entries will appear under My media if you’re their owner (entry.userId == YOUR_USER_ID) or, if you’re listed as an editor or a publisher.
The KalturaMediaEntryFilter object includes these members:
entitledUsersEditMatchOr
entitledUsersPublishMatchOr
userIdIn
userIdEqual

The first three can accept a comma separated list of user IDs.