Basic API DomainParkingFinalStatistics

Synopsis
public array DomainParkingFinalStatistics( array $finalstatisticsrequest )
Description

Returns parking statistics for a Sedo customer.

There are 5 different types of statistics.

  1. Statistics for one day either for a specific domain or for all the user's domains, sorted by Sedo. The date must be within the range of the last 31 days.
  2. Statistics for the last 31 days in a day by day summary.
  3. Statistics for one month for a specific domain, or all the user's domains, sorted by Sedo.
  4. Statistics for all months for a specific domain, or all the user's domains.
  5. Statistics for the last 31 days in a domain summary.
SOAP
This function can be called using SOAP.
XML
This function can be called using GET / POST requests.
Parameters
Type Parameter Mandatory Description
integer $partnerid yes Partner ID.
string $signkey yes Sign key.
string $username yes User name. (max. 25 characters)
string $password yes Password. (max. 16 characters)
string $domain no Domain name in ACE format.
integer $period yes Reporting period:
  • 0 - One day. (requires $date to be set)
  • 1 - Last 31 days as day by day summary.
  • 2 - One month. (requires $date to be set)
  • 3 - Last 12 months.
  • 4 - Last 31 days as domain summary.
string $date no Date in the format YYYY-MM-DD. Mandatory for $period values 0 and 2.
integer $startfrom yes Start position. Mandatory for $period values 0 and 2, otherwise 0.
integer $results yes

Number of results from the start position. Mandatory for $period values 0 and 2, otherwise 0.

Returns
Type Description
array

The return value contains the following elements:

Type Key Description
string domain Domain name in ACE format, but only if the statistics apply to a domain and only for the $period values 0, 2 and 4.
string date Day or month in format YYYY-MM-DD.
integer visitors Amount of visitors.
integer clicks Amount of clicks.
double earnings Amount of earnings.
string payout_status Whether the earnings are final or estimates.
Version
1.0
<?php
try {
    // Create a new client by providing the endpoint to the constructor.
    $client = new SoapClient(
        null,
        [
            'location'     => 'https://api.sedo.com/api/v1/',
            'soap_version' => SOAP_1_1,
            'encoding'     => 'UTF-8',
            'uri'          => 'urn:SedoInterface',
            'style'        => SOAP_RPC,
            'use'          => SOAP_ENCODED,
        ]
    );

    // Set the values for the array
    $params = [
        'partnerid' => 1234,
        'signkey'   => 'abcdefghijklmnopqrstuvwxyz0123456789',
        'username'  => 'johndoe',
        'password'  => 'secret',
        'domain'    => 'example.com',
        'period'    => 0,
        'date'      => '2017-01-01',
        'startfrom' => 0,
        'results'   => 0,
    ];

    // Call the SOAP method
    $result = $client->DomainParkingFinalStatistics($params);

    // Display the result
    echo "<table>";
    echo "<tr>";
    echo "<td>Domain</td>";
    echo "<td>Date</td>";
    echo "<td>Visitors</td>";
    echo "<td>Clicks</td>";
    echo "<td>Earnings</td>";
    echo "<td>Payout Status</td>";
    echo "</tr>";
    for ($i = 0; $i < count($result); $i++) {
        echo "<tr>";
        echo "<td> " . $result[$i]['domain'] . "</td>";
        echo "<td>" . $result[$i]['date'] . "</td>";
        echo "<td>" . $result[$i]['visitors'] . "</td>";
        echo "<td>" . $result[$i]['clicks'] . "</td>";
        echo "<td>" . $result[$i]['earnings'] . "</td></tr>";
        echo "<td>" . $result[$i]['payout_status'] . "</td>";
        echo "</tr>";
    }
    echo "</table>";
} catch (SoapFault $e) {
    echo 'Error: '.$e->getMessage();
}
<?php
/* URL to Sedo's API */
$baseUrl = 'https://api.sedo.com/api/v1/DomainParkingFinalStatistics?';

/* API function parameters */
$params = [
    'partnerid'     => 1234,
    'signkey'       => 'abcdefghijklmnopqrstuvwxyz0123456789',
    'username'      => 'johndoe',
    'password'      => 'secret',
    'output_method' => 'xml',
    'domain'        => 'example.com',
    'period'        => 0,
    'date'          => '2017-01-01',
    'startfrom'     => 0,
    'results'       => 0,
];

/* build request URL */
$request = $baseUrl . http_build_query($params);

/* fire API request */
$fp = @fopen($request, 'r');

/* read response line by line */
while (!@feof($fp)) {
    echo fread($fp, 4096);
}

/* close the connection */
fclose($fp);

For a successful request, you will receive an XML document as response in this format:

<?xml version="1.0" encoding="UTF-8"?>
<SEDOSTATS ver="1.0">
    <item>
        <domain type="xsd:string">example.com</domain>
        <date type="xsd:string">2017-01-01</date>
        <visitors type="xsd:int">0</visitors>
        <clicks type="xsd:int">0</clicks>
        <earnings type="xsd:double">0</earnings>
        <payout_status type="xsd:string">Estimated</earnings>
    </item>
</SEDOSTATS>

For an unsuccessful request, you will receive an XML document as response in this format:

<?xml version="1.0" encoding="UTF-8"?>
<SEDOFAULT ver="1.0">
    <faultcode type="xsd:string">Exxx</faultcode>
    <faultstring type="xsd:string">xxxxxx</faultstring>
</SEDOFAULT>
// Create package sedoapi:
// java org.apache.axis.wsdl.WSDL2Java -av -p sedoapi https://api.sedo.com/api/v1/?wsdl

import sedoapi.*;
import org.apache.axis.AxisFault;

public class SedoDomainParkingFinalStatistics
{
    public static void main(String[] args) throws Exception
    {
        sedoapi.SedoInterfaceServiceLocator locator = new sedoapi.SedoInterfaceServiceLocator();
        sedoapi.SedoInterfacePortType port = locator.getSedoInterfacePort();

        try {
            DomainParkingFinalStatisticsRequest request = new DomainParkingFinalStatisticsRequest();

            request.setPartnerid(1234);
            request.setSignkey("abcdefghijklmnopqrstuvwxyz0123456789");
            request.setUsername("johndoe");
            request.setPassword("secret");
            request.setDomain("example.com");
            request.setPeriod(0);
            request.setDate("2017-01-01");
            request.setStartfrom(0);
            request.setResults(10);

            DomainParkingFinalStatisticsResponse[] response = port.domainParkingFinalStatistics(request);

            for (int i = 0; i < response.length; i++) {
                System.out.println("Domain: " + response[i].getDomain());
                System.out.println("Date: " + response[i].getDate());
                System.out.println("Visitors: " + response[i].getVisitors());
                System.out.println("Clicks: " + response[i].getClicks());
                System.out.println("Earnings: " + response[i].getEarnings());
                System.out.println("Payout Status: " + response[i].getPayoutStatus());
                System.out.println("--------");
            }
        } catch (AxisFault fault) {
            System.err.println("Faultcode : " + fault.getFaultCode());
            System.err.println("Faultstring : " + fault.getFaultString());
        }
    }
}