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 ids).

Gpf_Rpc_FormRequest extends the Gpf_Rpc_Request, so all method from parent class are available in Gpf_Rpc_FormRequest. This documentation gives information on methods that are unique to this class. Please refer to Gpf_Rpc_Request for additional information.

Constructor:
Gpf_Rpc_FormRequest($className, $methodName, Gpf_Api_Session $apiSessionObject = null)
$className - name of the class you are calling.
$methodName - name of the method you are calling. Only public methods can be called. The definitions of those methods can be found in the class file. For Pap_Merchants_Campaign_CampaignForm, the file is in include/Pap/Merchants/Campaign/CampaignForm.class.php
$apiSessionObject - Gpf_Api_Session object that contains the URL where to send the request and session details. This parameter is optional, but recommended.

Methods:
getForm() - get response as Gpf_Rpc_Form.
setField($name, $value) - Set the field in the form.
setFields(Gpf_Data_IndexedRecordSet $fields) - Set all the fields using Gpf_Data_IndexedRecordSet

Example:

Add affiliate to commission group.
 
  $request = new Gpf_Rpc_FormRequest("Pap_Features_CommissionGroups_AffiliateGroupForm", "add", $session);
  // Id should be blank, it is populated automatically
  $request->setField('Id','');

  // Affiliate's user id.
  $request->setField('userid','252da3f5');

  // Affiliate's status in the commission group.
  $request->setField('rstatus','A');

  // Note about the affiliate in the commission group
  $request->setField('note','');

  // Commission group id
  $request->setField('commissiongroupid','7afb3b88');

  // Campaign id in which is the commission group
  $request->setField('campaignid','11111111');
  
  try  {
    // Send the request to PAP
    $request->sendNow();
  } catch(Exception $e){
    die("API call error: " . $e->getMessage());
  }

  // Get the response as stdClass Object
  $response = $request->getStdResponse();

  // Display info/error message
  if ($response->success == 'Y') {
    echo 'Success: ' . $response->message;
  } else {
    echo 'Unsuccess: ' . $response->message;
  }
×