Simply add the CommissionJunction API library to your composer.json
file:
{
"require": {
"croscon/commissionjunction-php": "dev-master"
}
}
The API library simply needs your Commission Junction developer key (which can be obtained at https://api.cj.com/sign_up.cj).
<?php
$client = new \CROSCON\CommissionJunction\Client($api_key);
Commission Junction's API documentation can be found here.
The API library provides a generic api($subdomain, $resource, array $params = array(), $version = 'v2')
method that accepts the subdomain, resource name, GET parameters, and optionally the api version number. When you view an individual REST service's documentation page, you will see a sample URI at the top of the page. The URI maps to the api(...)
method as follows:
https://SUBDOMAIN.api.cj.com/VERSION/RESOURCE?PARAMS
Alternatively the library provides a few convenience methods for the major resources listed in the documentation:
<?php
$client->productSearch($parameters);
$client->linkSearch($parameters);
$client->publisherLookup($parameters);
$client->advertiserLookup($parameters);
$client->supportLookup($resource, $parameters);
Each method corresponds to the individual resource documentation pages found under the "REST APIs" section.