Skip to content

Reports api #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update README with reports api
  • Loading branch information
Cyril Tata authored and cyriltata committed Jul 8, 2015
commit c09bf2ca3692c13f7a8bdc02686638cbecd5d369
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ test.php
build_docs.sh
.DS_Store

/nbproject/
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,78 @@ Modify the above script to meet your needs.

Your [notifications page](https://app.zencoder.com/notifications) will come in handy.

REPORTS
----------------------
The ZencoderReports class is used to get reports over the zencoder api.
See [reports api doc](https://app.zencoder.com/docs/api/reports) for required/optional parameters.

### Get usage for VOD
Create a script to get usage for VOD

#### Example
<?php

// Make sure this points to a copy of Zencoder.php on the same server as this script.
require_once('Services/Zencoder.php');

// Initialize the Services_Zencoder class
$zencoder = new Services_Zencoder('93h630j1dsyshjef620qlkavnmzui3');

// Get reports
$params = array(
'from' => '2014-02-01',
'to' => '2014-02-28',
)
$reports = $zencoder->reports->vod($params);
// for live reports you just call the 'live' method i.e $reports = $zencoder->reports->live($params) ($params is optional)

if ($reports->statistics) {
foreach ($reports->statistics as $statistic) {
print_r($statistic);
}
print_r($reports->total);
} else {
echo "no statistics found";
}

?>

### Get usage for VOD & Live
Get reports containing a breakdown of VOD and live-streaming usage.

**see return structure at:**
<https://app.zencoder.com/docs/api/reports/all>

#### Example
<?php

// Make sure this points to a copy of Zencoder.php on the same server as this script.
require_once('Services/Zencoder.php');

// Initialize the Services_Zencoder class
$zencoder = new Services_Zencoder('93h630j1dsyshjef620qlkavnmzui3');

// Get reports
$params = array(
'from' => '2014-02-01',
'to' => '2014-02-28',
)
$reports = $zencoder->reports->all($params);

// $reports->statistics if not empty will be an array with keys 'vod' and 'live' (same for $reports->total)

if (!empty($reports->statistics['vod'])) {
foreach ($reports->statistics['vod'] as $statistic) {
print_r($statistic);
}
print_r($reports->total['vod']);
} else {
echo "no vod statistics found";
}

?>


VERSIONS
---------

Expand Down