This function allows you to get statistics such as the clicks, payout, and total sales of a specific affiliate for a specified date range. To use this function, you must make a SOAP call with the following parameters:
- loginid - The ID of the affiliate whose stats you are requesting
- offerid - (optional) The ID of the offer to get set to 0 for all offers
- startDate - (optional) The date to start getting stats
- endDate - (optional) The date to end getting stats
- aff_subids - (optional) an array of affiliate subids to include for the stats lookup
NuSOAP Example
This example continues from the main article NuSOAP Example:
$values = Array(
'loginid' => 2,
'offerid' => 1, //(optional) The ID of the offer to get set to 0 for all offers
'startDate' => '2011-10-01', //(optional) The date to start getting stats
'endDate' => '2011-10-03', //(optional) The date to end getting stats
'aff_subids' => Array('aff_subid' => 'Apple', 'aff_subid2' => 'iPhone') //optional, aff_subid, aff_subid2, aff_subid3, aff_subid4, aff_subid5 are allowed
);
$result = $client->call('get_affiliate_stats', $values, 'offeritapiadmin_wsdl');
Sample Output
Array
(
[loginid] => 2
[clicks] => 121
[unique] => 3
[payout_amount] => 23900
[total_sales] => 0
)
Server Request/Response
Request:
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:offeritapiadmin_wsdl"><SOAP-ENV:Body><tns:get_affiliate_stats xmlns:tns="urn:offeritapiadmin_wsdl">
<loginid xsi:type="xsd:int">2</loginid><offerid xsi:type="xsd:int">1</offerid>
<startDate xsi:type="xsd:string">2011-8-14</startDate>
<endDate xsi:type="xsd:string"></endDate>
</tns:get_affiliate_stats></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response:
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:offeritapiadmin_wsdl"><SOAP-ENV:Body><ns1:get_affiliate_statsResponse xmlns:ns1="urn:offeritapiadmin_wsdl">
<return xsi:type="tns:AffStats"><loginid xsi:type="xsd:int">2</loginid><clicks xsi:type="xsd:int">121</clicks>
<unique xsi:type="xsd:int">3</unique>
<payout_amount xsi:type="xsd:string">23900</payout_amount>
<total_sales xsi:type="xsd:int">0</total_sales>
</return></ns1:get_affiliate_statsResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>