API access

API access

Dognet has an option to be connected to the administration via APIs. It currently runs on the low-level requests system.

For APIs it is necessary to download PapApi.class.php. For the latest version go to https://login.dognet.sk/api/download.php.

Dognet uses the back-end Post Affiliate Network. It can access APIs as an advertiser and a publisher alike. It works technically such that a developer tapping to an API makes use of low-level requests – thus any job involving the system can be simulated via an API, which is a big advantage. A publisher/advertiser can control via an API anything which can also traditionally be done via the browser.

 

For advertisers

Advertisers most commonly uses APIs to update commission states (approval, rejection). When importing states using Excel is not enough, you can choose to employ the automated commission closure via APIs. We have a separate article on that – Implementing the automated commission closure.

For the full documentation, see web page Quality Unit.

 

For publishers

Publishers most commonly use APIs to obtain commissions. Here is an example how to code:

<?php

include 'PapApi.class.php'; 

$session = new Pap_Api_Session("https://login.dognet.sk/scripts/server.php");
if(!$session->login("affiliate@example.com","password", Pap_Api_Session::AFFILIATE)) {
  die("Cannot login. Message: ". $session->getMessage());
} //creating session with your email and password

$request = new Gpf_Rpc_GridRequest("Pap_Affiliates_Reports_TransactionsGrid", "getRows", $session); //creating request

$request->addParam('columns', new Gpf_Rpc_Array(array(array('commission'), array('orderid')))); //what data do you need?

$request->setLimit(0, 30); // limit 30(max 100). 0 is offset = will start with first record. (if you need more than 100 entries, it should be done in the cycle where the offset will be changed)

// sending request
try {
  $request->sendNow();
} catch(Exception $e) {
  die("API call error: ".$e->getMessage());
}

// loading grid
$grid = $request->getGrid();

$recordset = $grid->getRecordset();

// iteration
foreach($recordset as $rec) {
  echo 'order ID: '.$rec->get('orderid').'<br>';
  echo 'commission: '.$rec->get('commission').'<br><br>';
}

?>

 

See also the guide to getting banners via APIs.

In case of questions relating to APIs, please contact us 😉

Štefan Polgári

V online marketingu sa pohybuje už viac ako 10 rokov. Spoluzaložil affiliate sieť DOGNET a affiliate marketingu sa venuje na profesionálnej úrovni. Spoločne s kolegami sa snažia tento odbor na Slovensku pozdvihnúť a zapojiť čo najviac publisherov.

More articles that might interest you

Which campaigns are available in our network?