Overview

Post Affiliate Pro API Post Affiliate Pro system is divided into two parts: * client – AJAX application running on browser * server – PHP based back end Client communicates with server using requests and responses encoded inJSON format (http://support.qualityunit.com/110653-Data-model-JSON-description). Because of this, the application natively supports API and everything that you can control through merchant or affiliate control panel, you can access also from external applicati...

API Requirements

Requests can be sent using any programming language, you only need to follow ourJSON format (http://support.qualityunit.com/110653-Data-model-JSON-description)of requests/responses. We provide PHP object library (single file _PapApi.class.php_) that simplifies making the requests to the Post Affiliate ProAPI and processing the responses. PapApi.class.php is part of every Post Affiliate Pro (since version 4.1.4.5) distribution and can be found in api folder in your installation files or you can ...

High level API

It gives you objects that correspond tothe entities, for example object for affiliate or commission. Usingthese objects you can easily retrieve, edit or add affiliates,commissions, or other objects of the affiliate system. Thesehigh level objects are extended from and internally use the low levelAPI objects to make the requests and process responses. Exampleof using high level API (PHP code): // getting list of affiliates $request = new Pap_Api_AffiliatesGrid($session); $request->addFi...

Low level API

Our API library contains low level APIclasses and methods that allow you to send requests like asking for aform, or asking for a list of records (grid). There classes (for exampleGpf_Rpc_GridRequest,Gpf_Rpc_FormRequest) are general purpose classesto handle general requests. Exampleof using low level API (PHP code): // getting list of affiliates $request = new Gpf_Rpc_GridRequest("Pap_Merchants_User_AffiliatesGrid", "getRows", $session); $request->addFilter("search", Gpf_Data_Filter::LIKE...

Data model (JSON) description

The data transferred between client and server (request from client - response from server) are encoded in JSON format. This is the lowest level of communication. You can to use this level of communication, if you cannot to use provided library of classes for PHP (file _PapApi.class.php_) that allow you to create the requests and process responses. Gpf_Api_Session Login JSON requestcontains parameters: - C: class name "Gpf_Api_AuthService" - M: method name "authenticate" - fields: list of fiel...

Data model (JSON) example of use

In Post Affiliate Pro you can create and use JSON data model for any action that is possible to do via Merchant Panel and Affiliate Panel. You can get the actual JSON which is called on different actions by debugging (https://support.qualityunit.com/775501-Debugging-with-Firefox) the requests with Firebug for example. The JSON data which you get by debugging (https://support.qualityunit.com/775501-Debugging-with-Firefox) should be URL encoded (you can use this nice tool (http://meyerweb.com/eri...

Click tracking request data description

Post Affiliate Pro tracking is based on requests between client (banner destination web page, 'thank you page') and server.If it is the first request, browser visitor cookie is not loaded, the server generates a new cookie value and sends it to the client as a response. JavaScript on Client will store the received cookie value to browser and flash cookie. If browser visitor cookie is loaded and inserted into request parameter 'visitorId', then response is empty and click/sale is saved under affi...

Sale (action) tracking request data description

Sale/action tracking request This request is sent from sale tracker to Post Affiliate Pro server: http://my_pap_url/scripts/track.php?visitorId=b910a79d013c8856a01393511GPTWP0s&accountId=&url=H_localhost%2Ftests%2Fapi%2Fme%2Fsale.php&referrer=&tracking=1&getParams=&ip=127.0.0.1&sale=%5B%7B%22ac%22%3A%22%22%2C%22t%22%3A%22100%22%2C%22f%22%3A%22%22%2C%22o%22%3A%22oid%22%2C%22p%22%3A%22pid%22%2C%22d1%22%3A%22data1value%22%2C%22d2%22%3A%22data2value%22%2C%22d3%22%3A%22data3value%22%2C%22d4%22%3A%2...

Debugging with Firefox

Firebug addon for Firefoxis useful extension if you want to see the flow of requests betweenclient and server in the merchant or affiliate panel (see imagebelow). This way you can see which requests arecalled on particular actions, and what are their parameters. Example for adding banner: