If you want to load campaigns grid, you can use this example:

Note: The first parameter of setLimit() is an offset that is no longer used since version 5.11.8.1 — always pass 0. Paging is handled automatically: sending the same request object again returns the next page of records. The maximum number of records returned in one request is 500. Use the largest page size your script can handle, as it means fewer API calls. Details are described in the Gpf_Rpc_GridRequest article.

<?php
include 'PapApi.class.php';
//the PapApi.class.php can be downloaded from Tools->Integration->API->Download PapApi.class.php

$session = new Pap_Api_Session("https://your_pap_url/scripts/server.php");
if(!$session->login("merchant login","password")) {
    die("Cannot login. Message: ". $session->getMessage());
}

$request = new Gpf_Rpc_GridRequest("Pap_Merchants_Campaign_CampaignsGrid", "getRows", $session);
// sets the page size to 500 rows, which is the maximum per request
// the first parameter is an offset which is not used, always keep it at 0
$request->setLimit(0, 500);

//you can use general search
//$request->addFilter('search', 'L', 'Campaign name');
//sets columns, use it only if you want to retrieve other as default columns
//$request->addParam('columns', new Gpf_Rpc_Array(array(array('id'), array('name'), array('commissionsdetails'), array('rstatus'), array('commissionsexist'), array('account'), array('dateinserted'), array('isdefault'), array('rorder'))));

// execute request in a loop to load all data
// sending the same request again returns the next page
do {
    // send request
    try {
        $request->sendNow();
    } catch(Exception $e) {
        die("API call error: ".$e->getMessage());
    }
    // request was successful, get the grid result and its recordset
    $recordset = $request->getGrid()->getRecordset();
    iterate($recordset);
} while ($recordset->getSize() == $request->getLimit());

function iterate($recordset) {
    // iterate through the records
    foreach($recordset as $rec) {
        echo 'Campaign name: ' . $rec->get('name') . ' '. $rec->get('commissionsdetails') . '<br>';
        echo 'productID: ' . $rec->get('productid'). '<br>';
        echo 'ID: ' . $rec->get('campaignid'). '<br>';
        //Uncomment this line to display/obtain also the campaign category name
        //echo getCampaignCategory($rec->get('campaignid'), $session);
    }
}

function getCampaignCategory($campaignid, $session) {
    $request2 = new Gpf_Rpc_GridRequest("Pap_Features_CampaignsCategories_CampaignInCategoriesGrid", "getRows", $session);
    $request2->addFilter("campaignid","=",$campaignid);
    // send request
    try {
        $request2->sendNow();
    } catch(Exception $e) {
        die("API call error: ".$e->getMessage());
    }
    // request was successful, get the recordset and return the first category name
    foreach($request2->getGrid()->getRecordset() as $rec2) {
        return $rec2->get('name');
    }
}
?>

 

 
Variables that can be used in the $rec->get() parameter:
 
campaignid, rtype, rstatus, name, description, dateinserted, rorder, isdefault, networkstatus, logourl (it is the url to campaign image), productid, discontinueurl, validfrom, validto, validnumber, validtype, overwritecookie, accountid, account, accountstatus, commissionsexist, commissionsdetails