Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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
Loading
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
  • Loading branch information
cyriltata committed Jul 8, 2015
commit 0654a2849a397e3869a4a641327dad9a82d7ed63
57 changes: 10 additions & 47 deletions 57 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ $zencoder->jobs->progress($job_id);
$zencoder->inputs->details($input_id);
$zencoder->outputs->details($output_id);
$zencoder->notifications->parseIncoming();
$zencoder->reports->vod($array);
$zencoder->reports->live($array);
$zencoder->reports->all($array);
$zencoder->reports->details($report_type, $optional_params);
```

Any errors will throw a Services_Zencoder_Exception. You can call getErrors() on an exception
Expand Down Expand Up @@ -250,7 +248,7 @@ See [reports api doc](https://app.zencoder.com/docs/api/reports) for required/op
Create a script to get usage for VOD

#### Example
<?php
```php

// Make sure this points to a copy of Zencoder.php on the same server as this script.
require_once('Services/Zencoder.php');
Expand All @@ -259,13 +257,13 @@ Create a script to get usage for VOD
$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)

$params = array(
'from' => '2014-02-01',
'to' => '2014-02-28',
)
// 'all' can be replaced by 'vod' or 'live' acccording to entry points in docs
$reports = $zencoder->reports->details('all', $params);
// Each reports object should have a 'statistics' and 'total' base element
if ($reports->statistics) {
foreach ($reports->statistics as $statistic) {
print_r($statistic);
Expand All @@ -275,42 +273,7 @@ Create a script to get usage for VOD
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
2 changes: 1 addition & 1 deletion 2 Services/Zencoder/Reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Services_Zencoder_Reports extends Services_Zencoder_Base {
*
* @return Services_Zencoder_Report The object representation of the resource
*/
public function details($report_type, $params = array(), $opts = array()) {
public function details($report_type = 'all', $params = array(), $opts = array()) {
return new Services_Zencoder_Report($this->proxy->retrieveData("reports/$report_type", $params, $opts));
}

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.