Copyright © 2012 Kaltura Inc.
All Rights Reserved. Designated trademarks and brands are the property of their respective owners.
Use of this web site constitutes acceptance of the Terms of Use and Privacy Policy.
EduVideo.org
I am trying to use the Report getTotal functionality of the API.
I have the following code:
global $config, $dbl, $user_id, $user_info;
//define constants
define("KALTURA_PARTNER_ID", $config['kaltura']['partner_id']);
define("KALTURA_PARTNER_WEB_SERVICE_SECRET", $config['kaltura']['user_secret']);
define("SUB_KALTURA_PARTNER_ID", $config['kaltura']['sub_partner_id']);
//define session variables
$partnerUserID = $_REQUEST['id'];
//Construction of Kaltura objects for session initiation
$conf = new KalturaConfiguration(KALTURA_PARTNER_ID);
$client = new KalturaClient($conf);
$ks = $client->session->start(KALTURA_PARTNER_WEB_SERVICE_SECRET, $partnerUserID, KalturaSessionType::USER);
$client->setKs($ks);
$url = $config['kaltura']['apiurl']."?service=report&action=gettotal";
$reportInputFilter = array(
'fromDate' => strtotime('-1 month'),
'toDate' => time(),
'searchInTags' => true,
'searchInAdminTags' => false,
'keywords' => '',
'ignoreNull' => 0,
);
$objectIds = $info['cdn_video_id'];
$rep = $client->report->getTotal(1, $reportInputFilter,$objectIds);
I get a valid client but $rep = $client->report->getTotal(1, $reportInputFilter,$objectIds); returns nothing, not even an error.
Can anyone see what I am missing/doing wrong.
Thanks
GG
Got it.
I was treating
$reportInputFilteras an array. It needs to be setup as an object, see below:global $config, $dbl, $user_id, $user_info;
//define constants
define("KALTURA_PARTNER_ID", $config['kaltura']['partner_id']);
define("KALTURA_PARTNER_WEB_SERVICE_SECRET", $config['kaltura']['admin_secret']);
define("SUB_KALTURA_PARTNER_ID", $config['kaltura']['sub_partner_id']);
//define session variables
$partnerUserID = $_REQUEST['id'];
//Construction of Kaltura objects for session initiation
$conf = new KalturaConfiguration(KALTURA_PARTNER_ID,SUB_KALTURA_PARTNER_ID);
$client = new KalturaClient($conf);
$ks = $client->session->start(KALTURA_PARTNER_WEB_SERVICE_SECRET, $partnerUserID, KalturaSessionType::ADMIN);
$client->setKs($ks);
$reportInputFilter = new KalturaReportInputFilter();
$reportInputFilter->fromDate = strtotime('-1 month');
$reportInputFilter->toDate = time();
$objectIds = $info['cdn_video_id'];
$rep = $client->report->getTotal(1, $reportInputFilter,$objectIds);
list($count_plays,$sum_time_viewed,$avg_time_viewed,$count_loads,$load_play_ratio) = explode(",",$rep->data);
Now it works great.
GG