50onred/publisher-api

There is no license information available for the latest version (2.1) of this package.

API for Publishers to the 50onRed Publisher Dashboard

2.1 2015-06-11 18:41 UTC

This package is not auto-updated.

Last update: 2020-04-07 10:51:23 UTC


README

You can get an API key from your publisher dashboard.

Requirements

PHP 5.3.3 and later.

Composer

You can install the bindings via Composer. Add this to your composer.json:

{
  "require": {
    "50onred/publisher-api": "2.*"
  }
}

Then install via:

composer install

Or, do it in one shot with:

composer require "50onred/publisher-api:2.*"

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Manual Installation

If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the API.php file in the src directory.

require_once('/path/to/50onred/publisher-api-php/src/Fifty/PublisherAPI/API.php');

Getting Started

Simple usage looks like:

\Fifty\PublisherAPI\API::setApiKey('your_api_key');
$parameters = array(
    'filters' => array(
        'zone' => array('example_zone_name'), //Optional
        'geo' => array('US', 'CA') //Optional
        'monetization' => array('Banners', 'CA') //Optional
    ),
    'group_by' => array('monetization', 'date'), //Optional
    'start_date' => '2015-01-01', //Required
    'end_date' => '2015-01-02', //Required
    'pubtype' => 'js' //Required
);

$report = \Fifty\PublisherAPI\Report::custom($parameters); // returns a `SplFileObject`

while (!$report->eof()) {
    var_dump($report->fgetcsv());
}


Documentation

Please see https://publisher.50onred.com/api-docs/v2/index.html for up-to-date documentation.