Overview

Low level API is a set of classes for making requests and processing responses. They can be used to make requests for the entities that are not yet supported by high level API. Low level API classes have names in format Gpf_*****, in contrary with high level classes, whose names are in format Pap_Api_*****.

Pap_Api_Session

Class representing session (logged user). You must log in using this object before making any other requests. The session ID returned from login is valid for 4 hours. Available methods constructor Pap_Api_Session($url) - this method creates the session object. You have to specify full valid URL to the /scripts/server.php file of your installation. For example: https://something.postaffiliatepro.com/scripts/server.php login($username, $password, $roleType = self::MERCHANT, $languageCode = ...

Gpf_Rpc_Request

Gpf_Rpc_Request calls method of specified class. With this class you can call almost any class in the Post Affiliate Pro and do almost any action. For grids and forms, use Gpf_Rpc_GridRequest and Gpf_Rpc_FormRequest. Constructor: Gpf_RpcRequest($className, $methodName, $session) $className - name of the class you are calling. $methodName - name of the method in the class. Use addParam() if you want to pass parameters to the method. All available methods can be found out via debugging any r...

Gpf_Rpc_FormRequest

_Gpf_Rpc_FormRequest_ is used to send form information to the PAP. _Gpf_Api_Session_ uses this request to send log in information, for example. You can however use it to send other form information, like adding a banner or creating a campaign. Since this is a low level API call, it's not easy do those things as you need to either retrieve correct information (like commission group id) or you simply need to know those values (like campaign id for which you want to retrieve the commission group id...

Gpf_Rpc_GridRequest

This object is used to retrieve a grid (list of records, recordset). The grids can be used to retrieve for example list of affiliates, list of transactions, list of campaigns, etc. Constructor: Gpf_Rpc_Gridrequest($className, $methodName, $session) - creates grid request object. You have to specify name of the class + method to execute, and valid session object. Method name is usually “getRows”, class name depends on the grid you want to access. Methods: The following methods are availabl...

Gpf_Data_RecordSet

Recordset object contains records returned by the system. Methods: getSize() - returns number of records in recordset Iterating through the recordset The easiest way to work with the recordset is to iterate through it. If you use foreach statement, you'll get every record as an object. You can use get($columnName) method to retrieve value of the column. Example of iterating through recordset: // get recordset from the grid $recordset = $grid->getRecordset(); // iterate through the rec...

Gpf_Rpc_Params

API communicates with PAP through JSON requests. It needs first to create the request as list of all parameters, then it transforms it into a JSON request that is sent to Post Affiliate Pro. Various classes in the API uses the Gpf_Rpc_Params object to pass it between them self. Gpf_Rpc_Server finally constructs the JSON using this Gpf_Rpc_Params. This object is used almost exclusively by other classes internally and user usually does not need to work with this object. However, sometimes you mig...

Examples of use

1. How do I get list of all banners? With use of Gpf_Rpc_GridRequest you can use this code to get all banners from your merchant panel: include 'path/to/your/api/file/PapApi.class.php'; $session = new Pap_Api_Session("https://localhost/scripts/server.php"); //replace https://localhost/scripts with link to your PAP installation URL if(!$session->login("merchant_name", "merchant_password")) { die('Failed authentication'); } $request = new Gpf_Rpc_GridRequest("Pap_Merchants_Banner_Banne...

Gpf_Data_Grid

Grid object contains total number of records in the database, and recordset object with list of all returned records. Methods: getTotalCount() – gets total number of records in database (can be higher than number of records returned) getRecordset() – returns recordset object, that can be iterated by foreach PHP command to get the records. Example of using grid: //---------------------------------------------- // get recordset with list of affiliates $request = new Gpf_Rpc_GridRequest("Pap_...
×