Add banner via API

<?php // the PapApi.class.php file can be downloaded from the merchant panel at: // Tools > Integration > API Integration > Download PAP API // This include assumes the PapApi.class.php file is in the same directory as this particular script. include 'PapApi.class.php'; $session = new Pap_Api_Session("https://URL_TO_PAP/scripts/server.php"); //user your merchant username and password below if(!$session->login("Merchant Username","Merchant Password")) { die("Cannot login. Message: ...

Delete banners via API

If you wish to delete banners via php API, you need to know the IDs of the particular banners. <?php include 'PapApi.class.php'; $session = new Pap_Api_Session("https://URL_TO_PAP/scripts/server.php"); if(!$session->login("merchant@example.com","demo")) { die("Cannot login. Message: ". $session->getMessage()); } $bannerIDs = array('38a9d2c8','bb1723b8','e6c99e22'); //delete banners identified by those banner IDs $request = new Gpf_Rpc_FormRequest("Pap_Merchants_Banner_BannerForm", ...

Get (retrieve) banner codes via API (only for affiliates)

If some affiliates wish to obtain their banner codes via API so that they add all their banners to their page(s) dynamically and the fastest way possible, then the following php API example will come in handy. 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 th...

How to assign coupons via API

Examples how to assign coupon using API you can read in the Coupons feature description: How to assign coupon using API (https://support.qualityunit.com/531726-How-to-assign-coupon-using-API)

How to load (display) coupons via php API?

The following code shows, how you can load valid and assigned coupons via php API. 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](htt...

How to load coupon details via API

If you want to get information about coupon and affiliate from coupon code, you can use class Pap_Features_Coupon_OfflineSaleForm. <?php include 'PapApi.class.php'; //the PapApi.class.php can be found at the PAP installation folder, in the 'api' directory $session = new Pap_Api_Session("https://your_pap_url/scripts/server.php"); if(!$session->login("merchant login","password")) { die("Cannot login. Message: ". $session->getMessage()); } $couponCode = 'xxxxxx'; $request = new Gpf_...

Create (import) coupons via API

The following 2 examples will show how to create (import) coupons via php API. 1. Created (imported) coupons will have to be assigned manually to affiliates <?php //your PapApi.class.php file can be downloaded in the merchant panel: Tools>Integration>API Integration>Download PAP API include ("PapApi.class.php"); //this include assumes the PapApi.class.php is in the same dir as this script //change localhost/pap to the path of your Post Affiliate Pro installation $session = new...

Add a Replicated site banner via API

This is a sample code of how to create a Replicated site banner via API. <?php $papURL = "https://URL_TO_PostAffiliatePro"; //URL of your Post Affiliate Pro installation without any trailing slash $merchantUsername = "merchant@example.com"; //merchant username $merchantPassword = "123456"; //merchant password //your PapApi.class.php file can be downloaded in the merchant panel: //Tools>Integration>API Integration>Download PAP API include_once ("PapApi.class.php"); //this incl...

Load the whole Banners Categories tree

This is a sample code of how to load all [Banners Categories](https://support.qualityunit.com/441949-Banners-categories): <?php $papURL = "https://URL_TO_PostAffiliatePro"; //URL of your Post Affiliate Pro installation without any trailing slash $merchantUsername = "merchant@example.com"; //merchant username $merchantPassword = "123456"; //merchant password //your PapApi.class.php file can be downloaded in the merchant panel: //Tools>Integration>API Integration>Download PAP API inc...

Add (or remove) a banner to Banner Categories

You can use the following code to add (or remove) a specific banner to [Banner Categories](https://support.qualityunit.com/441949-Banners-categories). You'll need to know the IDs of the categories to which you want to add the banner or remove it from, you can get these IDs by loading all the categories as explained [here](https://support.qualityunit.com/184520-Load-the-whole-Banners-Categories-tree). To add a banner to a category you must set the category's "selected" attribute to Y and to remo...