Documentation Publisher Webservices (v2)

Introduction

Below you will find a collection of our publisher web services, which consist of an authentication web service as well as the following web services: Account, Inbox, Voucher & Promotions, Program List und Statistics.

Publisher Authentication

Each request to an affilinet web service requires an authentification token, which is valid for 20 minutes. With this web service, you can get it and you can check how much longer it is valid.

Logon

For a given publisher-ID and web service password, this method returns an authentification token, which is necessary for all other web service requests. Each token is valid for 20 minutes.

Endpoint

https://api.affili.net/V2.0/Logon.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php 
 
// Start session
session_start();
 
// Set Webservice endpoint and credentials
$wsdlAccountService = "https://api.affili.net/V2.0/AccountService.svc?wsdl";
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// You need an authentication token for every web service request. The Logon Class handles authentication.
// With the method getToken() you can get a token.
$logon = new Logon($username, $password);
$token = $logon->getToken();
 
// Example request: GetPublisherSummary  
$soapClient = new SoapClient($wsdlAccountService); 
$response = $soapClient->GetPublisherSummary($token);
 
// Output GetPublisherSummary response
print_r($response);
 
 
/**
* Logon Class that returns an authentication token 
*/  
class Logon 
{
     // Logon Webservice endpoint
 private $wsdl = "https://api.affili.net/V2.0/Logon.svc?wsdl";
 
 // Credentials
 private $username;
 private $password;
 
 // Soap Client instance
 private $soapClient;
 
 
 /**
  * Class constructor. Expects username and password
  * 
  * @param int $username your publisher Id
  * @param string $password your publisher web services password 
  */
 public function __construct($username, $password) {
     $this->username = $username;
     $this->password = $password;
     $this->soapClient = new SoapClient($this->wsdl);
 }
 
 /**
 * Get authentication token 
 * 
 * @return string
 */
 public function getToken() {
     // If there is no token stored or the token has already expired a new token is requested
     if(!isset($_SESSION['token']) or $this->tokenHasExpired()) {
 
         // Get new token and get store token expiration date
         $_SESSION['token'] = $this->createToken(); 
         $_SESSION['expiration_date'] = $this->getTokenExpirationDate();
     }
 
     // Return token
     return $_SESSION['token'];
 }
 
 /**
 * Checks if token is expired
 * 
 * @return boolean
 */
 private function tokenHasExpired() {
     // If expiration date is not available, return true
     if (!isset($_SESSION['expiration_date'])) {
         return true;
     }
 
     // Check if the token has already expired
     return date(DATE_ATOM) > $_SESSION['expiration_date'];
 }
 
 /**
 * Create a new authentication token 
 * 
 * @return string 
 */
 private function createToken() {
     // Send a request to the Affilinet Logon Service to get an authentication token
     return $this->soapClient->Logon(array(
         'Username'  => $this->username,
         'Password'  => $this->password,
         'WebServiceType' => 'Publisher'
     ));
 }
 
 /**
    * Get token expiration date
    * 
    * @return string 
    */
    private function getTokenExpirationDate() {
        // Send a request to the Affilinet Logon Service to get the token expiration date
        return $this->soapClient->GetIdentifierExpiration($_SESSION['token']); 
    }
}
        

Request Parameters

Each SOAP request to our web services require an authentication token. With this service, you can create such a token, which is valid for 20 minutes. The remaining time for which the token remains to be valid can be requested with GetIdentifierExpiration.

Request Parameters

Parameter Type Description
Username required String The affilinet publisher ID
Password required String The affilinet publisher web services password
WebServiceType required Enumeration Assign here “Publisher”, because of using publisher webservices.

Response

Property Type Description
CredentialToken String A token which you need for all other web service requests

GetIdentifierExpiration

When you have a logon token, this method lets you find out how much longer you can use it before it expires.

Endpoint

https://api.affili.net/V2.0/Logon.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php 
 
// Start session
session_start();
 
// Set Webservice endpoint and credentials
$wsdlAccountService = "https://api.affili.net/V2.0/AccountService.svc?wsdl";
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// You need an authentication token for every web service request. The Logon Class handles authentication.
// With the method getToken() you can get a token.
$logon = new Logon($username, $password);
$token = $logon->getToken();
 
// Example request: GetPublisherSummary  
$soapClient = new SoapClient($wsdlAccountService); 
$response = $soapClient->GetPublisherSummary($token);
 
// Output GetPublisherSummary response
print_r($response);
 
 
/**
* Logon Class that returns an authentication token 
*/  
class Logon 
{
     // Logon Webservice endpoint
 private $wsdl = "https://api.affili.net/V2.0/Logon.svc?wsdl";
 
 // Credentials
 private $username;
 private $password;
 
 // Soap Client instance
 private $soapClient;
 
 
 /**
  * Class constructor. Expects username and password
  * 
  * @param int $username your publisher Id
  * @param string $password your publisher web services password 
  */
 public function __construct($username, $password) {
     $this->username = $username;
     $this->password = $password;
     $this->soapClient = new SoapClient($this->wsdl);
 }
 
 /**
 * Get authentication token 
 * 
 * @return string
 */
 public function getToken() {
     // If there is no token stored or the token has already expired a new token is requested
     if(!isset($_SESSION['token']) or $this->tokenHasExpired()) {
 
         // Get new token and get store token expiration date
         $_SESSION['token'] = $this->createToken(); 
         $_SESSION['expiration_date'] = $this->getTokenExpirationDate();
     }
 
     // Return token
     return $_SESSION['token'];
 }
 
 /**
 * Checks if token is expired
 * 
 * @return boolean
 */
 private function tokenHasExpired() {
     // If expiration date is not available, return true
     if (!isset($_SESSION['expiration_date'])) {
         return true;
     }
 
     // Check if the token has already expired
     return date(DATE_ATOM) > $_SESSION['expiration_date'];
 }
 
 /**
 * Create a new authentication token 
 * 
 * @return string 
 */
 private function createToken() {
     // Send a request to the Affilinet Logon Service to get an authentication token
     return $this->soapClient->Logon(array(
         'Username'  => $this->username,
         'Password'  => $this->password,
         'WebServiceType' => 'Publisher'
     ));
 }
 
 /**
    * Get token expiration date
    * 
    * @return string 
    */
    private function getTokenExpirationDate() {
        // Send a request to the Affilinet Logon Service to get the token expiration date
        return $this->soapClient->GetIdentifierExpiration($_SESSION['token']); 
    }
}
        

Request Parameters

Once created, each authentification token is valid for 20 minutes. This method lets you find out, how much longer a given token remains to be valid.

CredentialToken

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”

Response

Property Type Description
ExpirationDate DateTime

The exact timestamp when the given token will expire.

Format:

  • YYYY-MM-DDTHH:MM:SS.mm

e.g. 2010-09-14T12:45:32.62

Account

The account web services are an easy access to all information of an affilinet publisher account. By using this data, publishers are brought up-to-speed on all news of their partnerships, important changes of commissions and a general overview of their account.

GetLinkedAccounts

Returns a list of linked publisher accounts for a specified publisher.

Endpoint

https://api.affili.net/V2.0/AccountService.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php 
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_SERVICE", "https://api.affili.net/V2.0/AccountService.svc?wsdl"); 
 
// Set credentials
$username = ''; // the publisher ID you want use for authentication
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));      
 
// Set parameters
$publisherId = ''; // the publisher Id you want to get linked accounts for               
 
// Send a request to the Account Service 
$soapRequest = new SoapClient(WSDL_SERVICE); 
$response = $soapRequest->GetLinkedAccounts(array(
    'CredentialToken' => $token,
    'PublisherId' => $publisherId
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.AccountWebservice; ("https://api.affili.net/V2.0/AccountService.svc?wsdl")
 
    #region Parameters for the authentification token
    // Insert the publisher ID to access the data
    string Username   = "";
    // Insert the publisher web services password to access the data
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
 
    // insert the publisher Id to get the linked accounts
    int publisherId = 0;
    LinkedAccount[] myAccounts = GetLinkedAccounts(myToken, publisherId);
}       
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;                   
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static LinkedAccount[] GetLinkedAccounts(string token, int publisherId)
{
    AccountService accountWS = new AccountService();
    affilinetContentXXL.Affilinet.AccountWebservice.GetLinkedAccountsRequest reqMes = new GetLinkedAccountsRequest();
    reqMes.CredentialToken = token;
    reqMes.PublisherId = publisherId;
    reqMes.PublisherIdSpecified = true;
 
    // return the result of tyoe LinkedAccount[] 
    return accountWS.GetLinkedAccounts(reqMes);
        

Request Parameters

GetLinkedAccountRequest

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
PublisherId required Integer Your affilinet publisher Id

Response

Property Type Description
LinkedAccountCollection Array of LinkedAccount List of all linked accounts

LinkedAccount

Property Type Description
AccountBalance Decimal Balance of the account
Currency String Currency of the account
MainUrl String The main URL of the publisher Id
PublisherId Integer The affilinet publisher Id of the account

GetPayments

Returns a list of payments for a specified publisher in a given time span.

Endpoint

https://api.affili.net/V2.0/AccountService.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php 
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_SERVICE", "https://api.affili.net/V2.0/AccountService.svc?wsdl"); 
 
// Set credentials
$username = ''; // the publisher ID you want to use for authentication
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));                        
 
// Set parameters
$startDate = strtotime("-1 week");
$endDate = strtotime("today");
$publisherId = ''; // the publisher ID you want to retrieve payments for (mandatory)
 
// Send a request to the Account Service 
$soapRequest = new SoapClient(WSDL_SERVICE); 
$response = $soapRequest->GetPayments(array(
    'CredentialToken' => $token,                
    'EndDate' => $endDate,
    'PublisherId' => $publisherId,
    'StartDate' => $startDate
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
protected void LoadWebService()
{               
  // first create the Web References
  using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")   
  using Affilinet.AccountWebservice; ("https://api.affili.net/V2.0/AccountService.svc?wsdl")
 
  #region Parameters for the authentification token
  // Insert the publisher ID for access the live data 
  string Username   = "";
  // Insert the publisher web services password for access the live data 
  string Password   = "";
  #endregion
 
  string myToken = GetAuthentificationToken(Username, Password, SandboxPublisherID, WebServiceTypes.Publisher);
 
  // insert the publisher Id to get the payment informations
  int publisherId = 0;
  DateTime startDate = DateTime.Now.AddMonths(-1);
  DateTime endDate = DateTime.Now;
  PaymentInformation[] myPayments = GetPayments(myToken, publisherId, startDate, endDate);
}
 
 
public static string GetAuthentificationToken(string username, string password, int sandboxPublisherID, WebServiceTypes WSType)
{
  Logon logonRequest = new Logon();
  logonRequest.Username = username;
  logonRequest.Password = password;
  logonRequest.WebServiceType = WSType;        
 
  Authentication logonService = new Authentication();
  return logonService.Logon(logonRequest);
}
 
public static PaymentInformation[] GetPayments(string token, int publisherId, DateTime startDate, DateTime endDate ) 
{
  AccountService accountWS = new AccountService();
  GetPaymentsRequest reqMes = new GetPaymentsRequest();
  reqMes.CredentialToken = token;
  reqMes.StartDate = startDate;
  reqMes.StartDateSpecified = true;
  reqMes.EndDate = endDate;
  reqMes.EndDateSpecified = true;            
  reqMes.PublisherId = publisherId;
  reqMes.PublisherIdSpecified = true;
 
  // return the result of tyoe PaymentInformation[] 
  return accountWS.GetPayments(reqMes);
}
        

Request Parameters

GetPaymentsRequest

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
StartDate required DateTime This parameter defines the start date for the evaluation. It is included in the evaluation
EndDate required DateTime This parameter defines the end date for the evaluation. It is included in the evaluation
PublisherId required Integer Your affilinet publisher Id

Response

Property Type Description
PaymentInformationcollection Array of PaymentInformation List of all payments

PaymentInformation

Property Type Description
Currency String Currency of the payment
GrossTotal Decimal Amount including VAT
NetTotal Decimal Amount excluding VAT
PaidDate DateTime Date when the payment was completed
PaymentDate DateTime Date when the payment was initiated
PaymentDetailInformationCollection Array of PaymentDetailInformation Payments for each single Publisher-ID (in case of linked accounts)
PaymentId Integer Id of the payment
PaymentStatus Enumeration

Defines the status of the payment.

Possible values are:

  • None
  • InProcess
  • Paid
  • Hold
  • SBAFormMissing

PaymentType Enumeration

Defines the method of payment.

Possible values are:

  • None
  • Transfer
  • Cheque
  • Moneybookers
  • PayPal

VATTotal Decimal The amount paid as tax

PaymentDetailInformation

Property Type Description
Net Decimal Amount excluding VAT
PaymentDetailId Integer ID of this transaction
PublisherId Integer Publisher-ID of this transaction

GetPublisherSummary

Generates an overview similar to that on the start page of the publisher area on the affilinet portal.

Endpoint

https://api.affili.net/V2.0/AccountService.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_SERVICE", "https://api.affili.net/V2.0/AccountService.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token  = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));
 
// Send a request to the Account Service 
$soapRequest = new SoapClient(WSDL_SERVICE); 
$response = $soapRequest->GetPublisherSummary($token);
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.InboxWebservice; ("https://api.affili.net/V2.0/PublisherInbox.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID
    string Username   = "";
    // Insert the publisher web services password
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
        
    PublisherSummary myResult = GetPublisherSummary(myToken);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;     
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static PublisherSummary GetPublisherSummary(string token)
{
    PublisherStatistics pubStatService = new PublisherStatistics();
    return pubStatService.GetPublisherSummary(token);
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”

Response

Property Type Description
Records Integer Number of entries returned
ErrorMsg String An error message is returned in this property, if something goes wrong with the request

PublisherSummary

Property Type Description
InboxMessages InboxMessages A summary of the content of the publisher inbox
Payments Payments A summary of the amount of money the publisher has earned on the affilinet platform
Partnerships Partnerships An overall status of the publisher’s partnerships
CurrentMonth Status A summary of the publisher’s commission in the current month
PreviousMonth Status A summary of the publisher’s commission in the last month

InboxMessages

Property Type Description
ChangedCommissionRates Integer Total number of messages on changed commission rates in inbox
PartnershipStatusMessages Integer Total number of messages on changed partnership status in inbox
Total Integer Total number of messages in inbox
UnreadMessages Integer Total number of unread messages in inbox

Payments

Property Type Description
LastPayment DateTime Date when the last payment was made. If no payment has been performed yet, 0001-01-01T:00:00:00 is returned.
TotalPayment Integer Total amount of money transferred from affilinet to the current publisher

Partnerships

Property Type Description
PartnershipsActive Integer Total number of advertisers with accepted partnership
PartnershipsWaiting Integer Total number of advertisers with partnership status “waiting”

Status

Property Type Description
Cancelled Decimal Total amount of money in cancelled transactions
Confirmed Decimal Total amount of money in confirmed transactions
Open Decimal Total amount of money in open transactions

Creative

This is a collection of methods, with which you can access the creatives which the advertisers have created for you.

GetCreativeCategories

Advertisers organize their creatives in categories. This method delivers these categories for you to process further.

Endpoint

https://api.affili.net/V2.0/PublisherCreative.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php 
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_SERVICE", "https://api.affili.net/V2.0/PublisherCreative.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));  
 
// Set request parameters
$programId = ''; // the program Id you want to get the results for (mandatory)
 
// Send a request to the Publisher Creative Service 
$soapRequest = new SoapClient(WSDL_SERVICE); 
$response = $soapRequest->GetCreativeCategories(array(
    'CredentialToken' => $token,
    'ProgramId' => $programId
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
Namespace WSAPI_CodeSamples.Services.PublisherCreative
{
    /// <summary>
    /// Encapsulates all service calls for the PublisherCreative service
    /// </summary>
    public class PublisherCreativeWrapper
    {
        /// <summary>
        /// The name of the client endpoint configured in the configuration file
        /// </summary>
        private const String publisherCreativeEndpoint = "DefaultPublisherCreative";
 
        /// <summary>
        /// Receive all categories for a program specified in the signature.
        /// </summary>
        /// <param name="credentialToken">The token used to authenticate the webservice caller</param>
        /// <param name="programId">The identifier of the program the caller needs the categories for</param>
        public void GetCreativeCategories(String credentialToken, Int32 programId)
        {
            /* 
             * The service proxy generated through the service reference, 
             * allowing service calls to any PublisherCreative service method
             */
            SvcPublisherCreative.PublisherCreativeServiceContractClient client = null;
            try
            {
                /* 
                 * request containing the input parameters:
                 * CredentialToken(to authenticate) and ProgramId (to specify the program you need the categories for)
                 */
                SvcPublisherCreative.GetCreativeCategoriesRequest request = new SvcPublisherCreative.GetCreativeCategoriesRequest();
                request.CredentialToken = credentialToken;
                request.ProgramId = programId;
 
                /* 
                 * Spoiler code for the GUI, which has to be IGNORED in this sample.
                 */
                Frame.SetRequest(request);
 
                /* 
                 * Initialization of the proxy with the name of the client endpoint configured in the configuration.
                 */
                client = new SvcPublisherCreative.PublisherCreativeServiceContractClient(publisherCreativeEndpoint);
 
                /* 
                 * Calling the service proxy to receive the response, 
                 * which can be parsed to get the needed information.
                 */
                SvcPublisherCreative.GetCreativeCategoriesResponse response = client.GetCreativeCategories(request);
 
                /* 
                 * Spoiler code for the GUI, which has to be IGNORED in this sample.
                 */
                Frame.SetResponse(response);
            }
            catch (FaultException<SvcPublisherCreative.PublisherCreativeFault> fe)
            {
                /* 
                 * Handling exceptions of type PublisherCreativeFault, 
                 * which occurs when there was a problem during the processing of request message.
                 * This code is only spoiler code. You should handle these exceptions in a way that fits your needs.
                 */
                Frame.SetResponse(fe.Detail.Errors);
            }
            finally
            {
                /* 
                 * Finally close the open connection to the service through the proxy.
                 */
                if (client != null)
                {
                    client.Close();
                }
            }
        }
 
    }
}
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package wsapi_publishercreative;
 
import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring.KeyValueOfstringstring;
import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfint;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBElement;
import webservices.framework.affilinet.svc.PublisherCreativeServiceContract;
import webservices.framework.affilinet.svc.PublisherCreativeServiceContractGetCreativeCategoriesPublisherCreativeFaultFaultFaultMessage;
import webservices.framework.affilinet.svc.PublisherCreativeServiceContractSearchCreativesPublisherCreativeFaultFaultFaultMessage;
import webservices.framework.affilinet.types.publishercreative.ArrayOfCreativeTypeEnum;
import webservices.framework.affilinet.types.publishercreative.ArrayOfHTMLLinkTypeEnum;
import webservices.framework.affilinet.types.publishercreative.ArrayOfTextLinkTypeEnum;
import webservices.framework.affilinet.types.publishercreative.CreativeCategory;
import webservices.framework.affilinet.types.publishercreative.CreativeDisplaySettings;
import webservices.framework.affilinet.types.publishercreative.CreativeTypeEnum;
import webservices.framework.affilinet.types.publishercreative.HTMLLinkTypeEnum;
import webservices.framework.affilinet.types.publishercreative.SearchCreativesQuery;
import webservices.framework.affilinet.types.publishercreative.TextLinkTypeEnum;
 
/**
 *
 * @author affilinet
 */
public class PublisherCreativeWrapper {
 
    public CreativeCategory GetCreativeCategories(String credentialToken, Integer programId)
    {
        try {
            /*
            ObjectFactory to create types that are used in the service
             */
            webservices.framework.affilinet.svc.ObjectFactory svcObjectFactory =
                    new webservices.framework.affilinet.svc.ObjectFactory();
            webservices.framework.affilinet.types.publishercreative.ObjectFactory typesObjectFactory =
                    new webservices.framework.affilinet.types.publishercreative.ObjectFactory();
            /*
            Create the service endpoint interface
             */
            webservices.framework.affilinet.svc.PublisherCreative service =
                    new webservices.framework.affilinet.svc.PublisherCreative();
            /*
            Create a proxy out of the service endpoint interface
             */
            PublisherCreativeServiceContract proxy =
                    service.getPort(PublisherCreativeServiceContract.class);
            /*
            Create typed parameters which will be used in the service call
             */
            JAXBElement<String> credentialTokenJE =
                    svcObjectFactory.createGetCreativeCategoriesRequestCredentialToken(credentialToken);
            
            /*
            Create typed request message which will be used in the service call
             */
            webservices.framework.affilinet.svc.GetCreativeCategoriesRequest request =
                    svcObjectFactory.createGetCreativeCategoriesRequest();
            request.setCredentialToken(credentialTokenJE);
            request.setProgramId(programId);
            /*
            call the service method and process the result
             */
            webservices.framework.affilinet.svc.GetCreativeCategoriesResponse response =
                    proxy.getCreativeCategories(request);
            return response.getCreativeCategoryCollection().getValue();
 
        } catch (PublisherCreativeServiceContractGetCreativeCategoriesPublisherCreativeFaultFaultFaultMessage ex) {
            Logger.getLogger(PublisherCreativeWrapper.class.getName()).log(Level.SEVERE, null, ex);
            List<KeyValueOfstringstring> errors =
                    ex.getFaultInfo().getErrors().getValue().getKeyValueOfstringstring();
            for(KeyValueOfstringstring error : errors) {
                System.out.println("ERROR: " + error.getKey() + " - " + error.getValue());
            }
        }
        return null;
    }
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
ProgramId required Integer The Id of the program whose creative categories you would like to receive.

Response

Property Type Description
CreativeCategoryCollection Array of CreativeCategory List of all linked creative categories of the requested program.

CreativeCategory

Property Type Description
CategoryId Integer Internal ID of the category.
ProgramId Integer The ID of the requested program.
ParentId Integer The ID of the parent category. If this is 0 then this category does not have any parent category.
CategoryName String The name of the category.
Description String An optional description of the category.
CreativeCount Integer The amount of creatives which are assigned to this category and available for the requesting publisher.
IsPowerLinkCategory Boolean If this is a category for PowerLinks, then it does not contain creatives which can be obtained via web service.

SearchCreatives

Returns a list of creatives, which match given search criteria.

Endpoint

https://api.affili.net/V2.0/PublisherCreative.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_CREAT", "https://api.affili.net/V2.0/PublisherCreative.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLoogon = new SoapClient(WSDL_LOGON);
$token = $soapLoogon->Logon(array(
    'Username'=> $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set DisplaySettings parameters
$displaySettings = array(
    'PageSize' => 10,
    'CurrentPage' => 1
);
 
// Set SearchCreativesQuery settings
$searchCreativesQuery = array('ProgramIds' => array('3432'));
     
// Send a request to the Publisher Creative Service  
$soapRequest = new SoapClient(WSDL_CREAT);
$response = $soapRequest->SearchCreatives(array(
    'CredentialToken' => $token,
    'DisplaySettings' => $displaySettings,
    'SearchCreativesQuery' => $searchCreativesQuery
));
     
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
 
namespace WSAPI_CodeSamples.Services.PublisherCreative
{
    /// 
    /// Encapsulates all service calls for the PublisherCreative service
    /// 
    public class PublisherCreativeWrapper
    {
        /// 
        /// The name of the client endpoint configured in the configuration file
        /// 
        private const String publisherCreativeEndpoint = "DefaultPublisherCreative";
 
        /// 
        /// Search creatives that match the provided parameters.
        /// 
        /// The token used to authenticate the webservice caller
        /// The programids the caller needs creatives for
        /// The identifiers of the categories the creatives should be in
        /// The creativetypes the creatives should match
        /// The htmlLinkTypes the creatives should be in
        /// The textLinkTypes the creatives should be in
        /// The maximum height of the needed creatives
        /// The minimum height of the needed creatives
        /// The maximum width of the needed creatives
        /// The minimum width of the needed creatives
        public void SearchCreatives(String credentialToken, List programIds, List categoryIds, 
            List creativeTypes,
            List hTMLLinkTypes, 
            List textLinkTypes, 
            Int32 maxHeight, Int32 minHeight, Int32 maxWidth, Int32 minWidth)
        {
            /* 
             * The service proxy generated through the service reference, 
             * allowing service calls to any PublisherCreative service method
             */
            SvcPublisherCreative.PublisherCreativeServiceContractClient client = null;
            try
            {

                /* 
                 * Display Settings specifying the format of the response, 
                 * please provide parameters that fit your needs (dynamically)
                 */
                SvcPublisherCreative.CreativeDisplaySettings displaySettings = new SvcPublisherCreative.CreativeDisplaySettings();
                displaySettings.CurrentPage = 1;
                displaySettings.PageSize = 100;

                /* 
                 * query containing the input parameters
                 */
                SvcPublisherCreative.SearchCreativesQuery searchCreativesQuery = new SvcPublisherCreative.SearchCreativesQuery();
                searchCreativesQuery.CategoryIds = categoryIds;
                searchCreativesQuery.CreativeTypes = creativeTypes;
                searchCreativesQuery.HTMLLinkTypes = hTMLLinkTypes;
                searchCreativesQuery.TextLinkTypes = textLinkTypes;
                searchCreativesQuery.MaxHeight = maxHeight;
                searchCreativesQuery.MinHeight = minHeight;
                searchCreativesQuery.MaxWidth = maxWidth;
                searchCreativesQuery.MinWidth = minWidth;
                searchCreativesQuery.ProgramIds = programIds;

                /* 
                 * request containing the input parameters:
                 * CredentialToken(to authenticate) and ProgramId (to specify the program you need the categories for)
                 */
                SvcPublisherCreative.SearchCreativesRequest request = new SvcPublisherCreative.SearchCreativesRequest();
                request.CredentialToken = credentialToken;
                request.DisplaySettings = displaySettings;
                request.SearchCreativesQuery = searchCreativesQuery;

                /* 
                 * Spoiler code for the GUI, which has to be IGNORED in this sample.
                 */
                Frame.SetRequest(request);

                /* 
                 * Initialization of the proxy with the name of the client endpoint configured in the configuration.
                 */
                client = new SvcPublisherCreative.PublisherCreativeServiceContractClient(publisherCreativeEndpoint);

                /* 
                 * Calling the service proxy to receive the response, 
                 * which can be parsed to get the needed information.
                 */
                SvcPublisherCreative.SearchCreativesResponse response = client.SearchCreatives(request);

                /* 
                 * Spoiler code for the GUI, which has to be IGNORED in this sample.
                 */
                Frame.SetResponse(response);
            }
            catch (FaultException fe)
            {
                /* 
                 * Handling exceptions of type PublisherCreativeFault, 
                 * which occurs when there was a problem during the processing of request message.
                 * This code is only spoiler code. You should handle these exceptions in a way that fits your needs.
                 */
                Frame.SetResponse(fe.Detail.Errors);
            }
            finally
            {
                /* 
                 * Finally close the open connection to the service through the proxy.
                 */
                if (client != null)
                {
                    client.Close();
                }
            }
        }

    }
}

        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
package wsapi_publishercreative;
 
import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring.KeyValueOfstringstring;
import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfint;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBElement;
import webservices.framework.affilinet.svc.PublisherCreativeServiceContract;
import webservices.framework.affilinet.svc.PublisherCreativeServiceContractGetCreativeCategoriesPublisherCreativeFaultFaultFaultMessage;
import webservices.framework.affilinet.svc.PublisherCreativeServiceContractSearchCreativesPublisherCreativeFaultFaultFaultMessage;
import webservices.framework.affilinet.types.publishercreative.ArrayOfCreativeTypeEnum;
import webservices.framework.affilinet.types.publishercreative.ArrayOfHTMLLinkTypeEnum;
import webservices.framework.affilinet.types.publishercreative.ArrayOfTextLinkTypeEnum;
import webservices.framework.affilinet.types.publishercreative.CreativeCategory;
import webservices.framework.affilinet.types.publishercreative.CreativeDisplaySettings;
import webservices.framework.affilinet.types.publishercreative.CreativeTypeEnum;
import webservices.framework.affilinet.types.publishercreative.HTMLLinkTypeEnum;
import webservices.framework.affilinet.types.publishercreative.SearchCreativesQuery;
import webservices.framework.affilinet.types.publishercreative.TextLinkTypeEnum;
 
/**
 *
 * @author affilinet
 */
public class PublisherCreativeWrapper {
 
    public webservices.framework.affilinet.types.publishercreative.Creative SearchCreatives(
            String credentialToken, List programIds, String searchString,
            List categoryIds, List creativeTypes,
            List hTMLLinkTypes, List textLinkTypes,
            Integer maxHeight, Integer minHeight, Integer maxWidth, Integer minWidth)
    {
        try {
            /*
            ObjectFactory to create types that are used in the service
             */
            webservices.framework.affilinet.svc.ObjectFactory svcObjectFactory =
                    new webservices.framework.affilinet.svc.ObjectFactory();
            webservices.framework.affilinet.types.publishercreative.ObjectFactory typesObjectFactory =
                    new webservices.framework.affilinet.types.publishercreative.ObjectFactory();
            /*
            Create the service endpoint interface
             */
            webservices.framework.affilinet.svc.PublisherCreative service =
                    new webservices.framework.affilinet.svc.PublisherCreative();
            /*
            Create a proxy out of the service endpoint interface
             */
            PublisherCreativeServiceContract proxy =
                    service.getPort(PublisherCreativeServiceContract.class);
            /*
            Create typed parameters which will be used in the service call
             */
            JAXBElement credentialTokenJE =
                    svcObjectFactory.createGetCreativeCategoriesRequestCredentialToken(credentialToken);

            JAXBElement categoryIdsJE = null;
            if(categoryIds != null) {
                ArrayOfint categoryIdsArray = new ArrayOfint();
                categoryIdsArray.getInt().addAll(categoryIds);
                categoryIdsJE =
                        typesObjectFactory.createSearchCreativesQueryCategoryIds(categoryIdsArray);
            }

            JAXBElement creativeTypesJE = null;
            if(creativeTypes != null) {
                ArrayOfCreativeTypeEnum creativeTypesArray =
                        typesObjectFactory.createArrayOfCreativeTypeEnum();
                creativeTypesArray.getCreativeTypeEnum().addAll(creativeTypes);
                creativeTypesJE =
                        typesObjectFactory.createSearchCreativesQueryCreativeTypes(creativeTypesArray);
            }
            
            JAXBElement htmlLinkTypesJE = null;
            if(hTMLLinkTypes != null) {
                ArrayOfHTMLLinkTypeEnum htmlLinkTypesArray =
                        typesObjectFactory.createArrayOfHTMLLinkTypeEnum();
                htmlLinkTypesArray.getHTMLLinkTypeEnum().addAll(hTMLLinkTypes);
                htmlLinkTypesJE =
                        typesObjectFactory.createSearchCreativesQueryHTMLLinkTypes(htmlLinkTypesArray);
            }

            JAXBElement textLinkTypesJE = null;
            if(textLinkTypes != null) {
            ArrayOfTextLinkTypeEnum textLinkTypesArray =
                    typesObjectFactory.createArrayOfTextLinkTypeEnum();
            textLinkTypesArray.getTextLinkTypeEnum().addAll(textLinkTypes);
            textLinkTypesJE =
                    typesObjectFactory.createSearchCreativesQueryTextLinkTypes(textLinkTypesArray);
            }

            JAXBElement programIdsJE = null;
            if(programIds != null) {
                ArrayOfint programIdsArray = new ArrayOfint();
                programIdsArray.getInt().addAll(programIds);
                programIdsJE =
                        typesObjectFactory.createSearchCreativesQueryProgramIds(programIdsArray);
            }

            JAXBElement searchStringJE = null;
            if(searchString != null) {
                searchStringJE =
                        typesObjectFactory.createSearchCreativesQuerySearchString(searchString);
            }
            /*
            Create the Query and DisplaySettings, after that set their properties
             */
            CreativeDisplaySettings displaySettings = 
                    new CreativeDisplaySettings();
            displaySettings.setCurrentPage(1);
            displaySettings.setPageSize(100);
            SearchCreativesQuery query = 
                    new SearchCreativesQuery();
            query.setCategoryIds(categoryIdsJE);
            query.setCreativeTypes(creativeTypesJE);
            query.setHTMLLinkTypes(htmlLinkTypesJE);
            query.setTextLinkTypes(textLinkTypesJE);
            query.setMaxHeight(maxHeight);
            query.setMinHeight(minHeight);
            query.setMaxWidth(maxWidth);
            query.setMinWidth(minWidth);
            query.setProgramIds(programIdsJE);
            query.setSearchString(searchStringJE);

            /*
            Create typed request message which will be used in the service call
             */
            JAXBElement displaySettingsJE =
                    svcObjectFactory.createSearchCreativesRequestDisplaySettings(displaySettings);
            JAXBElement queryJE =
                    svcObjectFactory.createSearchCreativesRequestSearchCreativesQuery(query);
            webservices.framework.affilinet.svc.SearchCreativesRequest request =
                    svcObjectFactory.createSearchCreativesRequest();
            request.setCredentialToken(credentialTokenJE);
            request.setDisplaySettings(displaySettingsJE);
            request.setSearchCreativesQuery(queryJE);
            /*
            call the service method and process the result
             */
            webservices.framework.affilinet.svc.SearchCreativesResponse response =
                    proxy.searchCreatives(request);
            return response.getCreativeCollection().getValue();

        } catch (PublisherCreativeServiceContractSearchCreativesPublisherCreativeFaultFaultFaultMessage ex) {
            Logger.getLogger(PublisherCreativeWrapper.class.getName()).log(Level.SEVERE, null, ex);
            List errors =
                    ex.getFaultInfo().getErrors().getValue().getKeyValueOfstringstring();
            for(KeyValueOfstringstring error : errors) {
                System.out.println("ERROR: " + error.getKey() + " - " + error.getValue());
            }
        }
        return null;
    }
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
DisplaySettings required DisplaySettings The page size and the page number.
SearchCreativesQuery required SearchCreativesQuery The search parameters which the desired creatives are supposed to fulfil.

DisplaySettings

Parameter Type Description
CurrentPage required Integer The number of the page of creatives which shall be returned.
PageSize required Integer The maximum number of creatives a page shall hold. Must be between 1 and 100.

SearchCreativesQuery

Parameter Type Description
CategoryIds Array of Integer The IDs of the creative categories whose contents shall be returned.
CreativeTypes Array of CreativeTypeEnum

The type of the desired creatives.

Possible values are:

  • Banner
  • Text
  • HTML
  • Rotation

HTMLLinkTypes Array of HTMLLinkTypeEnum

If you want to receive HTML links, you can define here what exact sub-types shall be returned.

Possible values are:

  • HTMLBanner
  • FlashBanner
  • Microsite
  • PopUp
  • PopUnder
  • IFrame
  • HTMLForm
  • FlashForm
  • VideoAd
  • ProductLink
  • BannerRotation
  • PagePeel
  • Other

MaxHeight Integer The maximum height (in px) of the returned creatives (only applicable for creatives which have an actual height).
MinHeight Integer The minimum height (in px) of the returned creatives (only applicable for creatives which have an actual height).
MaxWidth Integer The maximum width (in px) of the returned creatives (only applicable for creatives which have an actual width).
MinWidth Integer The minimum width (in px) of the returned creatives (only applicable for creatives which have an actual width).
ProgramIds required Array of Integer The IDs of the programs whose creatives shall be returned. If you want to search across all programs, please use the integer 0.
SearchString String

A key phrase that shall be contained in the creative.

The following fields are being searched through:

  • creative name
  • creative description
  • ALT-tag (in Banners or HTML creatives)
  • Header, Content and Footer (for Textlinks)

TextLinkTypes Array of TextLinkTypeEnum

If you want to receive text links, you can define here what exact sub-types shall be returned.

Possible values are:

  • TextLink
  • LinkGenerator
  • Microsite
  • Other

Response

Property Type Description
CreativeCollection Array of Creative List of all creatives matching the given search criteria.
TotalResults Integer The total amount of creatives matching the given search criteria.

Creative

Property Type Description
ProgramId Integer The ID of the program to which the creative belongs.
CreativeTypeEnum String

Defines what kind of creative this is.

Possible values are:

  • Banner
  • Text
  • HTML
  • Rotation

CreativeNumber Integer The identifier of the creative. ProgramId, CreativeType and CreativeNumber form a unique key within the affilinet platform.
InCategories Array of Integer The creative category Ids, to which this creative is assigned.
IntegrationCode String The ready-to-use HTML code to integrate this creative into the web page. Only needs to be HTML-decoded.
Title String The name which the advertiser has given to this creative.
BannerStub BannerStub The banner specific part of the creative. Filled only if the creative is of type Banner.
TextStub TextStub The text link specific part of the creative. Filled only if the creative is of type TextLink.
HTMLStub HTMLStub The HTML link specific part of the creative. Filled only if the creative is of type HTMLLink.
RotationStub RotationStub The rotation specific part of the creative. Filled only if the creative is of type Rotation.

BannerStub

Property Type Description
FileFormat String The graphics format of the banner (.gif, .jpg, .png, …).
AltTag String The character string which is displayed through a mouse-over on this banner.
BannerURL String The URL where the banner is delivered from.
Height Integer The height of the banner in pixel.
Width Integer The width of the banner in pixel.

TextStub

Property Type Description
Header String The first part of the text link (header part).
Content String The second part of the text link (middle part).
Footer String The third part of the text link (footer part).
IsHeaderLinked Boolean Indicates if the Header field is enclosed with a link.
IsContentLinked Boolean Indicates if the Content field is enclosed with a link.
IsFooterLinked Boolean Indicates if the Footer field is enclosed with a link.
IsDynamic Boolean Indicates if the text link is exchanged dynamically (can pose an impediment to page design).
TextLinkTypeEnum String

The subtype of the text link.

Possible values are:

  • TextLink
  • LinkGenerator
  • Microsite
  • Other

HTMLStub

Property Type Description
HTMLLinkTypeEnum String

The subtype of the HTML creative.

Possible values are:

  • HTMLBanner
  • FlashBanner
  • Microsite
  • PopUp
  • PopUnder
  • IFrame
  • HTMLForm
  • FlashForm
  • VideoAd
  • ProductLink
  • BannerRotation
  • PagePeel
  • Other

HTMLLinkURL String The URL where the creative is delivered from.
Height Integer The height of the HTML creative in pixel.
Width Integer The width of the HTML creative in pixel.

RotationStub

Property Type Description
Height Integer The height of the rotation creative in pixel.
Width Integer The width of the rotation creative in pixel.

Inbox

GetProgramInfoMessages

With this method, you can receive the individual messages, which advertisers send their publishers.

Endpoint

https://api.affili.net/V2.0/PublisherInbox.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_SERVICE", "https://api.affili.net/V2.0/PublisherInbox.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username'  => $username,
    'Password'  => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters
$params = array(
    'TimeSpan' => 'Last7days', // timespan of the messages 
    'Query' => '', // the search query
    'MessageStatus' => 'UnreadMessages' // status of the messages
);
 
// Send a request to the Publisher Inbox Service  
$soapRequest = new SoapClient(WSDL_SERVICE);
$response = $soapRequest->GetProgramInfoMessages(array(
    'CredentialToken' => $token,
    'GetProgramInfoMessagesRequestMessage' => $params
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.InboxWebservice; ("https://api.affili.net/V2.0/PublisherInbox.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID
    string Username   = "";
    // Insert the publisher web services password
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the parameters to get the products    
    string query = "newsletter";
    ProgramInfoMessages myProgramInfoMessage = GetProgramInfoMessages(myToken, MessageStatus.All, query, affilinetContentXXL.Affilinet.InboxWebservice.TimeSpan.Last3months );
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;       
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static ProgramInfoMessages GetProgramInfoMessages(string token, MessageStatus messagestatus, string query, Affilinet.InboxWebservice.TimeSpan timespan)
{
    PublisherInbox pubinbox = new PublisherInbox();
    GetProgramInfoMessagesRequestMessage gpiMessRsMess = new GetProgramInfoMessagesRequestMessage();
    gpiMessRsMess.MessageStatus = messagestatus;
    gpiMessRsMess.Query = query;
    gpiMessRsMess.TimeSpan = timespan;
    return pubinbox.GetProgramInfoMessages(token, gpiMessRsMess);
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
GetProgramInfoMessagesRequestMessage required GetProgramInfoMessagesRequestMessage The object which contains the search parameters

GetProgramInfoMessagesRequestMessage

Parameter Type Description
TimeSpan required Enumeration

This parameter defines the timespan of the messages that ought to be retrieved.

Possible values are:

  • LastLogin
  • Last7days
  • Last14days
  • LastMonth
  • Last3months

Query String The search query
MessageStatus required Enumeration

This parameter specifies what status that the returned messages ought to have.

Possible values are:

  • All
  • UnreadMessages
  • ReadMessages

Response

Property Type Description
Messages Array of Message List of found messages

Message

Property Type Description
Body String Message text
DeletionDate DateTime Date when message was deleted. If the message is not deleted, the date is set to ‘1900-01-01’ as default
HasBeenDeleted Boolean ‘true’ = message deleted
‘false’ = message not deleted
HasBeenRead Boolean ‘true’ = message has been read
‘false’ = unread message
IsLegalAdvice Boolean ‘true’ = this message is a legal advice coming from the current advertiser
‘false’ = this message is not a legal advice
LogoUrl String URL of the logo of the advertiser
MailId Integer The identifier of the mail
MessageDate DateTime Date when the message has been sent
Priority Integer Numeric value indicating the priority of the current message
ProgramId Integer ID of the program
ProgramTitle String Title of the program
ReadDate DateTime Date when the message was read. For unread messages, this is set to ‘1900-01-01’
Subject String Subject of the message

GetProgramStatusMessages

Retrieves the program status messages from the publisher's inbox.

Endpoint

https://api.affili.net/V2.0/PublisherInbox.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_SERVICE", "https://api.affili.net/V2.0/PublisherInbox.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters
$params = array(
    'TimeSpan' => 'Last3months',
    'Query' => '',
    'MessagePartnershipStatus' => 'AllAcceptedPartnerships'
);
 
// Send request to Publisher Inbox Service
$soapRequest = new SoapClient(WSDL_SERVICE);
$response = $soapRequest->GetProgramStatusMessages(array(
    'CredentialToken' => $token,
    'GetProgramStatusMessagesRequestMessage' => $params
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.InboxWebservice; ("https://api.affili.net/V2.0/PublisherInbox.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access the live data 
    string Username   = "";
    // Insert the publisher web services password
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the parameters to get the products    
    string query = "";
    PartnershipStatusMessages myResult = GetProgramStatusMessages(myToken, MessagePartnershipStatus.AllPartnerships, query, Affilinet.InboxWebservice.TimeSpan.Last3months);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static PartnershipStatusMessages GetProgramStatusMessages(string token, MessagePartnershipStatus MessagePartnershipStatus, string query, Affilinet.InboxWebservice.TimeSpan timespan)
{
    PublisherInbox pubinbox = new PublisherInbox();
    GetProgramStatusMessagesRequestMessage gpsmRqMess = new GetProgramStatusMessagesRequestMessage();
    gpsmRqMess.MessagePartnershipStatus = MessagePartnershipStatus;
    gpsmRqMess.Query = query;
    gpsmRqMess.TimeSpan = timespan;
    return pubinbox.GetProgramStatusMessages(token, gpsmRqMess);
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
GetProgramStatusMessages
RequestMessage required
GetProgramStatusMessages
RequestMessage
The object which contains the search parameters

GetProgramStatusMessagesRequestMessage

Parameter Type Description
Query required String This parameter defines the search query for which records ought to be returned. Assign the empty string if you want all programs without any keyword restriction.
TimeSpan required Enumeration

This parameter defines the timespan of the messages that ought to be retrieved.

Possible values are:

  • LastLogin
  • Last7days
  • Last14days
  • LastMonth
  • Last3months

Query String The search query
MessagePartnershipStatus required Enumeration

This parameter restricts the returned messages to a certain partnership status.

Possible values are:

  • AllPartnerships
  • AllAcceptedPartnerships
  • AllTemporarilyAcceptedPartnerships
  • AllDeclinedPartnerships

Response

Property Type Description
Messages Array of PartnershipStatusMessage List of found messages

PartnershipStatusMessage


Property Type Description
ActionDate DateTime Date when the status changed
IsPayPerClickProgram Boolean ‘true’ = pay per click
‘false’ = different commission model
IsPayPerLeadProgram Boolean ‘true’ = pay per lead
‘false’ = different commission model
IsPayPerSaleProgram Boolean ‘true’ = pay per sale
‘false’ = different commission model
ProgramId Integer ID of the program
ProgramTitle String Title of the program
RejectionText String Reason why the application was declined
PartnershipAction Enumeration

The type of change that has been made on the partnership.

Possible values are:

  • NotFound
  • Null
  • Paused
  • Warning
  • SpecialPermission
  • SpecialPermissionEnd
  • Ok
  • Cancelled
  • Refused
  • Waiting
  • PreliminaryOk

WelcomeMessage String Message from the advertiser, if application was accepted

GetRateChanges

Retrieves the messages from the publisher's inbox, which announce changes of one of their remuneration rates.

Endpoint

https://api.affili.net/V2.0/PublisherInbox.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_SERVICE", "https://api.affili.net/V2.0//PublisherInbox.svc?wsdl");
 
// Set credentials
$username = ""; // the publisher ID
$password = ""; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username'  => $username,
    'Password'  => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters
$params = array(
    'TimeSpan' => 'LastLogin',
    'MessageStatus' => 'AllRates'  
);
 
// Send a request to the Publisher Inbox Service
$soapRequest = new SoapClient(WSDL_SERVICE);
$response = $soapRequest->GetRateChanges(array(
    'CredentialToken' => $token,
    'GetRateChangesRequestMessage' => $params
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.InboxWebservice; ("https://api.affili.net/V2.0/PublisherInbox.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID
    string Username   = "";
    // Insert the publisher web services password
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the parameters to get the result    
    string query = "";
    ChangedCommissionRates myResult = GetRateChanges(myToken, MessageRatesStatus.AllRates, true, query, Affilinet.InboxWebservice.TimeSpan.Last3months, true);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;      
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public ChangedCommissionRates GetRateChanges(string token, MessageRatesStatus MessageRatesStatus, bool MessageRatesStatusSpecified, string query, Affilinet.InboxWebservice.TimeSpan timeSpan, bool TimeSpanSpecified)
{
    PublisherInbox pubinbox = new PublisherInbox();
    GetRateChangesRequestMessage grcrqMess = new GetRateChangesRequestMessage();
    grcrqMess.MessageRatesStatus = MessageRatesStatus;
    grcrqMess.MessageRatesStatusSpecified = MessageRatesStatusSpecified;
    grcrqMess.Query = query;
    grcrqMess.TimeSpan = timeSpan;
    grcrqMess.TimeSpanSpecified = TimeSpanSpecified;
    return pubinbox.GetRateChanges(token, grcrqMess);
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
GetRateChangesRequestMessage required GetRateChangesRequestMessage The object which contains the search parameters

GetRateChangesRequestMessage

Parameter Type Description
TimeSpan required Enumeration

This parameter defines the timespan of the messages that ought to be retrieved.

Possible values are:

  • LastLogin
  • Last7days
  • Last14days
  • LastMonth
  • Last3months

Query String The search query
MessageStatus required Enumeration

This parameter specifies what status that the returned messages ought to have.

Possible values are:

  • AllRates
  • OnlyProgramsWithRaisedRates
  • OnlyProgramsWithLoweredRates

Response

Property Type Description
Messages Array of ChangedCommissionRateMessage List of found messages

ChangedCommissionRateMessage

Property Type Description
Date DateTime Date of the rate change
ProgramId Integer ID of the program
ProgramTitle String Title of the program
ChangedCommissionRates ChangedCommissionRates List of commission rate changes

ChangedCommissionRate

Property Type Description
Description String Description of the commission rate
NewValue Decimal New commission rate for the program
OldValue Decimal Old commission rate for the program
Unit String Value indicating the unit of the current commission rate e.g. “%” or “€”
ChangeIndicator ChangeIndicator Value indicating how the commission rate has changed
TransactionType TransactionType Value indicating the type of the current commission rate

SetMessageStatus

This method is used to change the status of a message for a specified publisher. Please note that once a message is set to "deleted" its status cannot be canged any more.

Endpoint

https://api.affili.net/V2.0/PublisherInbox.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_SERVICE",  "https://api.affili.net/V2.0/PublisherInbox.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher Id you want to use for authentication
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username'  => $username,
    'Password'  => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set MessageStatusSetterCollection parameters
20.$params = array(
    array(
        'MailMessageStatus' => 'Read',
        'MessageId' => 141
    ),
    array(
        'MailMessageStatus' => 'Read',
        'MessageId' => 142
    ),
);
 
$publisherId = ''; // the publisher ID for which you want to set the message status (mandatory)
 
// Send a request to the Publisher Inbox Webservice
$soapRequest = new SoapClient(WSDL_SERVICE); 
$response = $soapRequest->SetMessageStatus(array(
    'CredentialToken' => $token,
    'MessageStatusSetterCollection' => $params,
    'PublisherId' => $publisherId 
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.InboxWebservice; ("https://api.affili.net/V2.0/PublisherInbox.svc?wsdl")
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access the live data
    string Username   = "";
    // Insert the publisher web services password for access the live data
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the publisher Id to update the message status
    int publisherId = 0;
    MessageStatusSetter message1 = new MessageStatusSetter();
    message1.MessageId = 0;
    message1.MailMessageStatus = MailMessageStatus.Unread;
    MessageStatusSetter[] messageStatusSetterCollection = { message1 };
    
    int updatedMessages = SetMessageStatus(myToken, publisherId, messageStatusSetterCollection);
}
 
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static int SetMessageStatus(string token, MessageStatusSetter[] messageStatusSetterCollection)
{
    PublisherInbox inboxWS = new PublisherInbox();
    SetMessageStatusRequest reqMes = new SetMessageStatusRequest();
    reqMes.CredentialToken = token;
    reqMes.PublisherId = publisherId;
    reqMes.PublisherIdSpecified = true;
    reqMes.MessageStatusSetterCollection = messageStatusSetterCollection;
 
    // return the result of type int
    return inboxWS.SetMessageStatus(reqMes);
}

        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
MessageStatusSetterCollection required MessageStatusSetter Contains a list of MessageIds whichshould be updated and the update status
PublisherId required Integer Your affilinet publisher Id

MessageStatusSetter

Parameter Type Description
MailMessageStatus required Enumeration

This parameter defines the status of the message which should be set.

Possible values are:

  • None
  • Read
  • Unread
  • Deleted

Please note that once a message gets the status “deleted”, the status cannot be changed any more.

MessageId required Integer Id of the message which should be updated

Response

Property Type Description
UpdatedMessageCount Integer Amount of updated messages

Voucher & Promotion

This collection of methods lets you manage your vouchers and promotions via inbox web services.

SearchVoucherCodes

Several advertisers publish voucher codes, which grant a certain rebate to their customers. With this method, you can receive the voucher codes which match certain search criteria.

This is the successor of GetVouchercodes and will replace it after some time. Has more filter criteria and returns more detailed information.

Endpoint

https://api.affili.net/V2.0/PublisherInbox.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_WS", "https://api.affili.net/V2.0/PublisherInbox.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username'  => $username,
    'Password'  => $password,
    'WebServiceType' => 'Publisher'
));    
 
// Set DisplaySettings parameters
$displaySettings = array(
    'CurrentPage' => 1,
    'PageSize' => 10,
    'SortBy' => 'LastChangeDate',
    'SortOrder' => 'Descending'
);
 
// Set SearchVoucherCodesRequestMessage parameters
$params = array(
    'StartDate' => strtotime("now"),
    'EndDate' => strtotime("now"),
    'VoucherCodeContent' => 'Empty',
    'VoucherType' => 'AllProducts'
);
 
// Send a request to the Publisher Inbox Service  
$soapRequest = new SoapClient(WSDL_WS);
$response = $soapRequest->SearchVoucherCodes(array(
    'CredentialToken' => $token,
    'DisplaySettings' => $displaySettings,
    'SearchVoucherCodesRequestMessage' => $params
));
 
// Show response
print_r($response);
        

Request Parameters

With this method, it is possible to obtain the vouchers, which are present in the affilinet database, regardless whether or not an accepted partnership exists. If a partnership exists, then the actual voucher string is displayed together with the ready-to-use integration code. If no partnership exists, then the voucher is returned, but without the actual voucher code and the integration code.

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
SearchVoucherCodesRequestMessage required SearchVoucherCodesRequestMessage The object which contains the search parameters.
DisplaySettings required SearchVoucherCodesDisplaySettings Settings concerning the paging and sorting of the found records.

DisplaySettings

Parameter Type Description
CurrentPage required Integer The index of the page you wish to obtain. Must be an integer > 0.
PageSize required Integer The maximum amount of results you wish to receive per result page. Must be an integer between 1 and 1000.
SortBy Enum

The field you wish the results to be sorted by.

Possible values are:

  • Id
  • ProgramId
  • Title
  • LastChangeDate
  • StartDate
  • EndDate

If not specified, “Id” is assumed.

SortOrder Enum

The direction you wish the results to be sorted in.

Possible values are:

  • Ascending
  • Descending

If not specified, “Ascending” is assumed.

SearchVoucherCodesRequestMessage

Parameter Type Description
ProgramId Integer Only vouchers of this program are returned.
Query String Only vouchers, which contain this string in the voucher code, title, description, deeplink or advertiser name, are returned.
VoucherCode String Only vouchers, which contain this string in the voucher code, are returned. If the empty string is set here, then only vouchers without code are returned. If null value is assigned (=not set), then all vouchers are returned, which match the other criteria of this GetVoucherCodes-RequestMessage.
VoucherCodeContent Enum

Vouchers can come with or without an actual voucher code. If they don’t have a voucher code, then the customer gets the benefit automatically. With this parameter, you can limit the results to only those vouchers, which have a voucher code, or those, which don’t have a voucher code.

Possible values are:

  • Any
  • Empty
  • Filled

If not specified, “Any” is assumed.

StartDate DateTime Only vouchers with this start date (or earlier) are returned. Cannot be a date in the past. If you want to receive all currently valid vouchers, set StartDate and EndDate to the present moment. If not specified, then the current moment is assumed.
EndDate DateTime Only vouchers with this end date (or later) are returned. Cannot be earlier than StartDate. If you want to receive all currently valid vouchers, set StartDate and EndDate to the present moment. If not specified, then the current moment is assumed.
VoucherType Enum

Each voucher can belong to up to 3 types.

Possible values are:

  • AllProducts (voucher can be used for all products of this advertiser)
  • SpecificProducts (voucher can be used for a certain group of products, not all)
  • MultiBuyDiscount (can be used for a combination of products, e.g. “buy 3 for the price of 2”)
  • Free shipping (no delivery costs)
  • FreeProduct (by using this voucher, the customer gets an additional product free of charge)
  • Competition (by entering this voucher, the customer takes part in a competition)

If this parameter is specified, then only those vouchers are returned, which have been flagged with this voucher type. If this parameter is not specified, then no restriction regarding the voucher type is applied.

ProgramPartnershipStatus Enum

With this parameter you can filter the voucher list to those of programs with the specified partnership status.

Possible values are:

  • NoRestriction (the vouchers of all currently active programs (incl. paused programs) are returned, regardless of the partnership status)
  • Accepted (only those vouchers are returned, which belong to an active program, with which an accepted partnership exists)
  • Waiting (only vouchers of those programs are returned, to which the requesting publisher has applied for a partnership and has not yet been accepted or declined)
  • DeclinedOrDeleted (only vouchers of those programs are returned, with which either a parnership had been accepted, but meanwhile has been deleted, or who have declined the request for partnership)
  • NoPartnership (only vouchers of those programs are returned, with which no relation ever existed - neither accepted nor declined nor waiting)

If this parameter is not specified, then NoRestriction regarding the partnership status is applied.

MinimumOrderValue Decimal Many vouchers can only be used on shopping baskets, which exceed a certain minimum value. When you set this parameter, only those vouchers are returned, which have a minimum order value configured and whose minimum order value don’t exceed this amount.
CustomerRestriction Enum

Some vouchers can only be used by new customers. With this parameter you can restrict the results to either get only those vouchers, which all customers can use, or those vouchers, which only new customers can use.

Possible values are:

  • NoRestrictions
  • AllCustomers
  • OnlyNewCustomers

If not specified, “NoRestrictions” is assumed.

ExclusivesOnly Bool Advertisers can grant single vouchers to only an exclusive subset of their publishers. With this parameter, the requesting publisher can restrict the returned vouchers to only those, where his Id is entered in the list of allowed publishers.

Response

Property Type Description
VoucherCodeCollection Array of VoucherCodeItem Set of vouchers matching the given search criteria.
TotalResults Integer The total amount of vouchers matching the given search criteria.

VoucherCodeItem

Property Type Description
Id Integer Id of the voucher
ProgramId Integer Id of the advertiser
Code String The string that must be entered at the advertiser’s platform to receive the benefit described in the voucher description. If this is the empty string, then it is not required to enter anything on the advertiser’s platform.
Title String A short name of the voucher.
Description String This describes what benefit the voucher brings, and what prerequisites have to be met in order to use the voucher.
VoucherTypes Array of Enum

Each voucher can belong to up to 3 types.

Possible values are:

  • AllProducts
  • (voucher can be used for all products of this advertiser)
  • SpecificProducts (voucher can be used for a certain group of products, not all)
  • MultiBuyDiscount (can be used for a combination of products, e.g. “buy 3 for the price of 2”)
  • Free shipping (no delivery costs)
  • FreeProduct (by using this voucher, the customer gets an additional product free of charge)
  • Competition (by entering this voucher, the customer takes part in a competition)

This array can contain up to 3 of the above described values.

StartDate DateTime This is when the advertiser starts to accept this voucher.
EndDate DateTime This is when the advertiser no longer accepts this voucher.
LastChangeDate DateTime The timestamp, when this voucher has last been edited by the advertiser.
PartnershipStatus Enum

This reflects the partnership status, which the requesting publisher has with the program which has this voucher. If an accepted partnership exists, this voucher comes with a ready-to-use integration code.

Possible values are:

  • NoRestriction
  • Accepted
  • Waiting
  • DeclinedOrDeleted
  • NoPartnership

IntegrationCode String The ready-to-use HTML code which the publisher can integrate into his webpage. Decoding might be necessary. If no accepted partnership exists, this field is empty.
IsExclusive Bool If “true”, then the advertiser has marked this voucher as generally invisible, but has explicitly allowed the requesting publisher to see this voucher. This way, advertisers can distribute tailor-made vouchers for single publishers.
MinimumOrderValue Double If this voucher can only be used if a certain basket value is exceeded, this limit is returned here. If no such limit has been specified for a voucher, this field is null.
CustomerRestriction Enum

This reflects whether this voucher can be used by only new customers or all customers.

Possible values are:

  • NoRestrictions
  • AllCustomers
  • OnlyNewCustomers

GetVoucherCodes

Please note:
This method is deprecated. Please use "SearchVoucherCodes" instead.

Program List

With more than 2500 programs across Europe affilinet offers a breadth of programs to choose from for each publisher. The program web services ease the search for new programs using a defined set of criteria. In addition, new programs can be found easily as well as programs allowing certain ad formats, commissions and the like.

GetPrograms

Is used to return programs that match given search criteria.

Endpoint

https://api.affili.net/V2.0/PublisherProgram.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_PROGRAM", "https://api.affili.net/V2.0/PublisherProgram.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username'  => $Username,
    'Password'  => $Password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters
$displaySettings = array(
    'PageSize' => 5,
    'CurrentPage' => 1
);
 
$getProgramsQuery = array(
    'PartnershipStatus' => array('Active','Waiting')
);
 
// Send request to Publisher Program Service
$soapRequest = new SoapClient(WSDL_PROGRAM);
$response = $soapRequest->GetPrograms(array(
    'CredentialToken' => $token,
    'DisplaySettings' => $displaySettings,
    'GetProgramsQuery' => $getProgramsQuery
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WSAPI_CodeSamples.SvcPublisherProgram;
using System.ServiceModel;
 
namespace WSAPI_CodeSamples.Services.PublisherProgram
{
    /// 
    /// Encapsulates all service calls for the PublisherInbox service
    /// 
    public class PublisherProgramWrapper
    {
        /// 
        /// The name of the client endpoint configured in the configuration file
        /// 
        private const String publisherProgramEndpoint = "PublisherProgramEndpoint";
 
        /// 
        /// Receive programinformation for programs that match the provided parameters.
        /// 
        /// The token used to authenticate the webservice caller
        /// Restrict to those programs that automatically accept partnership applications
        /// Restrict on the commission mode of the programs. Possible values are: Click, ClickOut, Sale, Lead
        /// True, to receive only programs which provide product data
        /// True, to receive only programs which provide at least one voucher
        /// Restricts the programs to those, which are featured as new in the affilinet platform
        /// Only those programs will be returned which were launched at least this many months ago
        /// Only those programs will be returned whose cookies are valid at least this many days
        /// Restricts the results to programs with which you have any of these partnership status values
        /// The amount of days which lie between each product data update of the programs
        /// Restricts the programs to those who belong to any of these program categories
        /// Select what kind of program results shall be returned. Possible values are: All, Program, Campaign
        /// The results will be restricted to programs contained in this parameter
        /// A keyword that must be contained in the program (title, keywords, description, ...)
        /// Restrict on the SEM policy which the desired programs shall have
        /// Restrict on the tracking method used in the desired programs
        public void GetPrograms(
            String credentialToken, 
            bool? autoAccept, 
            List commissionTypes,
            bool? hasProductData,
            bool? hasVoucherCodes,
            bool isNew, 
            int? maximumProgramLifetime, 
            int? minimumCookieLifetime,
            List partnershipStatus, 
            int? productDataUpdateInterval, 
            List programCategoryIds, 
            ProgramClassificationEnum programClassificationEnum, 
            List programIds, 
            String searchString,
            List semPolicyTypes, 
            List trackingMethods)
        {
            /* 
             * The service proxy generated through the service reference, 
             * allowing service calls to any PublisherInbox service method
             */
            PublisherProgramContractClient client = null;
            try
            {
                /*
                 * query containing the input parameters
                 */
                GetProgramsQuery programsQuery = new GetProgramsQuery();
                programsQuery.AutoAccept = autoAccept;
                programsQuery.CommissionTypes = commissionTypes;
                programsQuery.HasProductData = hasProductData;
                programsQuery.HasVoucherCodes = hasVoucherCodes;
                programsQuery.IsNew = isNew;
                programsQuery.MaximumProgramLifetime = maximumProgramLifetime;
                programsQuery.MinimumCookieLifetime = minimumCookieLifetime;
                programsQuery.PartnershipStatus = partnershipStatus;
                programsQuery.ProductDataUpdateInterval = productDataUpdateInterval;
                programsQuery.ProgramCategoryIds = programCategoryIds;
                programsQuery.ProgramClassificationEnum = programClassificationEnum;
                programsQuery.ProgramIds = programIds;
                programsQuery.SearchString = searchString;
                programsQuery.SEMPolicyTypes = semPolicyTypes;
                programsQuery.TrackingMethods = trackingMethods;

                /* 
                 * Display Settings specifying the format of the response, 
                 * please provide parameters that fit your needs (dynamically)
                 */
                DisplaySettings displaySettings = new DisplaySettings();
                displaySettings.CurrentPage = 1;
                displaySettings.PageSize = 100;
                displaySettings.SortByEnum = SortByEnum.ProgramId;
                displaySettings.SortOrderEnum = SortOrderEnum.Ascending;

                /* 
                 * Spoiler code for the GUI, which has to be IGNORED in this sample.
                 */
                GetProgramsRequest request = new GetProgramsRequest(credentialToken, displaySettings, programsQuery);
                Frame.SetRequest(request);

                /* 
                 * Initialization of the proxy with the name of the client endpoint configured in the configuration.
                 */
                client = new PublisherProgramContractClient(publisherProgramEndpoint);

                int totalResults;
                /* 
                 * Calling the service proxy to receive the response, 
                 * which can be parsed to get the needed information.
                 */
                SvcPublisherProgram.Program response = 
                    client.GetPrograms(credentialToken, displaySettings, programsQuery, out totalResults);
                
                /* 
                 * Spoiler code for the GUI, which has to be IGNORED in this sample.
                 */
                Frame.SetResponse(response);

            }
            catch (FaultException fe)
            {
                /* 
                 * Handling exceptions of type PublisherProgramFault, 
                 * which occurs when there was a problem during the processing of request message.
                 * This code is only spoiler code. You should handle these exceptions in a way that fits your needs.
                 */
                Frame.SetResponse(fe.Detail.ErrorMessages);
            }
            finally
            {
                /* 
                 * Finally close the open connection to the service through the proxy.
                 */
                if (client != null)
                {
                    client.Close();
                }
            }
        }
    }
}
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
package wsapi_publisherprogram;
 
import com.microsoft.schemas._2003._10.serialization.arrays.ArrayOfKeyValueOfstringstring.KeyValueOfstringstring;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.bind.JAXBElement;
import webservices.framework.affilinet.svc.GetProgramsRequest;
import webservices.framework.affilinet.svc.GetProgramsResponse;
import webservices.framework.affilinet.svc.PublisherProgramContract;
import webservices.framework.affilinet.svc.PublisherProgramContractGetProgramsPublisherProgramFaultFaultFaultMessage;
import webservices.framework.affilinet.types.publisherprogram.ArrayOfProgramPartnershipStatusEnum;
import webservices.framework.affilinet.types.publisherprogram.DisplaySettings;
import webservices.framework.affilinet.types.publisherprogram.GetProgramsQuery;
import webservices.framework.affilinet.types.publisherprogram.Program;
import webservices.framework.affilinet.types.publisherprogram.ProgramPartnershipStatusEnum;
import webservices.framework.affilinet.types.publisherprogram.SortByEnum;
import webservices.framework.affilinet.types.publisherprogram.SortOrderEnum;
 
/**
 *
 * @author affilinet
 */
public class PublisherProgramWrapper {
 
    public Program GetPrograms(String credentialToken,
            Integer currentPage, Integer pageSize, SortByEnum sortBy, SortOrderEnum sortOrder) {
        try {
            /*
            ObjectFactory to create types that are used in the service
             */
            webservices.framework.affilinet.svc.ObjectFactory svcObjectFactory = new webservices.framework.affilinet.svc.ObjectFactory();
            webservices.framework.affilinet.types.publisherprogram.ObjectFactory typesObjectFactory = new webservices.framework.affilinet.types.publisherprogram.ObjectFactory();
            /*
            Create the service endpoint interface
             */
            webservices.framework.affilinet.svc.PublisherProgram service = new webservices.framework.affilinet.svc.PublisherProgram();
            /*
            Create a proxy out of the service endpoint interface
             */
            PublisherProgramContract proxy = service.getPort(PublisherProgramContract.class);
            
            /*
            Create typed parameters which will be used in the service call
             */
            JAXBElement credentialTokenJE = svcObjectFactory.createCredentialToken(credentialToken);
            /*
            Create the request message and DisplaySettings, after that set their properties
             */
            ArrayOfProgramPartnershipStatusEnum psStatusList =
                typesObjectFactory.createArrayOfProgramPartnershipStatusEnum();
            psStatusList.getProgramPartnershipStatusEnum().add(ProgramPartnershipStatusEnum.ACTIVE);
            JAXBElement psStatusListJE =
                    typesObjectFactory.createGetProgramsQueryPartnershipStatus(psStatusList);

            GetProgramsQuery getProgramsQuery = new GetProgramsQuery();
            getProgramsQuery.setPartnershipStatus(psStatusListJE);

            DisplaySettings displaySettings = new DisplaySettings();
            displaySettings.setCurrentPage(currentPage);
            displaySettings.setPageSize(pageSize);
            displaySettings.setSortByEnum(sortBy);
            displaySettings.setSortOrderEnum(sortOrder);
            /*
            Create typed request message which will be used in the service call
             */
            JAXBElement getProgramsQueryJE =
                    svcObjectFactory.createGetProgramsRequestGetProgramsQuery(getProgramsQuery);
            JAXBElement displaySettingsJE =
                    svcObjectFactory.createGetProgramsRequestDisplaySettings(displaySettings);
            GetProgramsRequest request = svcObjectFactory.createGetProgramsRequest();
            request.setCredentialToken(credentialTokenJE);
            request.setDisplaySettings(displaySettingsJE);
            request.setGetProgramsQuery(getProgramsQueryJE);

            /*
            call the service method and process the result
             */
            GetProgramsResponse response = proxy.getPrograms(request);

            return response.getProgramCollection().getValue();
        } catch (PublisherProgramContractGetProgramsPublisherProgramFaultFaultFaultMessage ex) {
            Logger.getLogger(PublisherProgramWrapper.class.getName()).log(Level.SEVERE, null, ex);
            List errors =
                    ex.getFaultInfo().getErrorMessages().getValue().getKeyValueOfstringstring();
            for(KeyValueOfstringstring error : errors) {
                System.out.println("ERROR: " + error.getKey() + " - " + error.getValue());
            }
        }
        return null;
    }

}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
DisplaySettings required DisplaySettings Defines the paging and sorting of the found programs.
GetProgramsQuery required GetProgramsQuery The search parameters to which the desired programs shall match.

DisplaySettings

Parameter Type Description
CurrentPage required Integer The number of the page to view.
PageSize required Integer The number of results which shall be contained per result page. Must be between 1 and 100.
SortByEnum Enumeration

The criteria along which the results shall be sorted.

Possible values are:

  • ProgramId
  • ProgramTitle
  • ProgramLifetime
  • Default value is ProgramId

SortOrderEnum Enumeration

The order in which the results shall be sorted.

Possible values are:

  • Ascending
  • Descending
  • Default value is Ascending.

GetProgramsQuery

Parameter Type Description
ProgramIds Array of integer The results will be restricted to programs out of this array.
SearchString String A keyword that must be contained in the program (searches within program title, keywords, description and others).
PartnershipStatus required Array of ProgramPartnershipStatusEnum Restricts the results to programs with which you have any of these partnership status values.
ProgramClassificationEnum Enumeration

Lets you select what kind of program results shall be returned.

Possible values are:

  • All
  • Program
  • Campaign

ProgramCategoryIds Array of integer Restricts the programs to those who belong to any of these program categories (GetProgramCategories).
TrackingMethods Array of TrackingMethod Lets you restrict on the tracking method used in the desired programs.
SEMPolicyTypes Array of SEMPolicyEnum Lets you restrict on the SEM policy which the desired programs shall have.
MinimumCookieLifetime Integer Only those programs will be returned whose cookies are valid at least this many days.
MaximumProgramLifetime Integer Only those programs will be returned which were launched at least this many months ago.
AutoAccept Boolean Lets you restrict to those programs that automatically accept partnership applications.
HasProductData Boolean Set this to ‘true’ if you want to receive only programs which provide product data.
HasVoucherCodes Boolean Set this to ‘true’ if you want to receive only programs which provide at least one voucher.
ProductDataUpdateInterval Integer The max amount of days which lie between each product data update of the programs. If you e.g. specify 7, then the method returns all programs, which update their product data at least every 7th day or more often.
IsNew Boolean Restricts the programs to those, which are featured as new in the affilinet platform.
CommissionTypes Array of CommissionTypeEnum

CommissionTypeEnum

Parameter Type Description
CommissionTypeEnum Enumeration

Lets you restrict on the commission mode of the programs.

Possible values are:

  • Click
  • ClickOut
  • Sale
  • Lead

SEMPolicyEnum

Parameter Type Description
SEMPolicyEnum Enumeration

Lets you restrict on the SEM policy which the desired programs shall have.

Possible values are:

  • NotSet (the program has not set any SEM policy yet)
  • Allowed (SEM generally allowed)
  • Restricted (SEM allowed only with certain restrictions)
  • NotAllowed (no SEM allowed)

TrackingMethod

Parameter Type Description
TrackingMethod Enumeration

The tracking technology which shall be used in the returned program

Possible values are:

  • Cookie
  • Session
  • SessionCookie

ProgramPartnershipStatusEnum

Parameter Type Description
ProgramPartnershipStatusEnum Enumeration

The status of the partnership you have with this program.

Possible values are:

  • Active
  • Paused
  • Waiting
  • Refused
  • NoPartnership
  • Cancelled

Response

Property Type Description
ProgramCollection Array of Program List of found programs.
TotalResults Integer The total amount of programs matching the given search criteria.

Program

Property Type Description
ProgramId Integer The Id of the advertiser program
ProgramTitle String Title of the program
ProgramDescription String The program description
PartnershipStatus String

The status of the partnership with this program.

Possible values are:

  • Active
  • Paused
  • Waiting
  • Refused
  • NoPartnership
  • Cancelled

ProgramClassificationEnum String

The business type of the advertiser.

Possible values are:

  • Program
  • Campaign
  • All

LimitationsComment String A free text field where the advertiser lists limitations on the partnership.
LaunchDate DateTime The day when the program has launched.
ProgramURL String A link to the home page of the program.
LogoURL String A link to the logo of the program, 120 by 40 px in size.
TrackingMethod String

The tracking technology used by the program.

Possible values are:

  • Cookie
  • Session
  • Sessioncookie

CookieLifetime Integer The number of days a cookie is valid for this program.
ProgramCategoryIds Array of integer The program category Ids to which this program is mapped. (see GetProgramCategories)
SEMPolicyEnum String

The kind of restriction which the advertiser has for SEM business.

Possible values are:

  • NotSet (the program has not set any SEM policy yet)
  • Allowed (SEM generally allowed)
  • Restricted (SEM allowed only with certain restrictions)
  • NotAllowed (no SEM allowed)

ProgramStatusEnum String

The status in which this program currently is.

Possible values are:

  • Active
  • Paused

CommissionTypes Array of CommissionTypeDetail Information on the commissions paid by this program.
ScreenshotURL String A URL under which a screenshot of the program homepage can be reached.

CommissionTypeDetail

Property Type Description
CommissionTypeEnum String

The commission mode this program has.

Possible values are:

  • Click
  • ClickOut
  • Sale
  • Lead

VolumeMin Decimal The minimum commission paid in this rate mode by this program per transaction.
VolumeMax Decimal The maximum commission paid in this rate mode by this program per transaction.
Unit String The unit of the values given in VolumeMax and VolumeMin. Can be %, EUR or GBP.

GetProgramCategories

Returns the affilinet program categories.

Endpoint

https://api.affili.net/V2.0/PublisherProgram.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php 
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_WS", "https://api.affili.net/V2.0/PublisherProgram.svc?wsdl");
 
// Set credentials
$username = ""; // the publisher ID
$password = ""; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username'  => $username,
    'Password'  => $password,
    'WebServiceType' => 'Publisher'
));
 
// Send a request to the Publisher Program Service 
$soapRequest = new SoapClient(WSDL_WS);
$response = $soapRequest->GetProgramCategories($token);
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.PublisherProgramWebservice; ("https://api.affili.net/V2.0/PublisherProgram.svc?wsdl")
 
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access
    string Username   = "";
    // Insert the publisher web services password for access
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
 
    ProgramCategories myResult = GetProgramCategories(myToken);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;          
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static ProgramCategories GetProgramCategories(string token)
{
    PublisherProgram pubProgramService = new PublisherProgram();
    return pubProgramService.GetProgramCategories(token);
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”

Response

Property Type Description
RootCategories ProgramCategory List of ProgramCategory objects

ProgramCategory

Property Type Description
CategoryId Integer ID of program category
DateInsert DateTime Date of set-up of program category
DateUpdate DateTime Date of last update of program category
Name String Title of program category
ParentCategoryId Integer ID of parent program category
Programs Integer Number of programs contained in this program category
SubCategories Array of ProgramCategory List of sub categories of current program category

GetProgramRates

Is used to return a list of commission rates for a specified publisher and program.

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_SERVICE", "https://api.affili.net/V2.0/PublisherProgram.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username'  => $username,
    'Password'  => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters
$publisherId = ''; // the publisher Id (mandatory)
$programId = ''; // the program ID you want to get the rates for (mandatory)
 
// Send request to Publisher Program Service
$soapRequest = new SoapClient(WSDL_SERVICE); 
$response = $soapRequest->GetProgramRates(array(
    'CredentialToken' => $token,
    'PublisherId' => $publisherId,
    'ProgramId' => $programId
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.PublisherProgramWebservice; ("https://api.affili.net/V2.0/PublisherProgram.svc?wsdl")     
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access
    string Username   = "";
    // Insert the publisher web services password for access
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the publisher Id to get the program rates
    int publisherId = 0;
    int programId = 0;
    Rate[] myRates = GetProgramRates(myToken, publisherId, programId);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;          
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static Rate[] GetProgramRates(string token, int publisherId, int programId)
{
    PublisherProgram programWS = new PublisherProgram();
    GetProgramRatesRequest reqMes = new GetProgramRatesRequest();
    reqMes.CredentialToken = token;
    reqMes.ProgramId = programId;
    reqMes.ProgramIdSpecified = true;
    reqMes.PublisherId = publisherId;
    reqMes.PublisherIdSpecified = true;
 
    // return the result of type Rate[]
    return programWS.GetProgramRates(reqMes);
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
PublisherId required Integer Your affilinet publisher Id
ProgramId required Integer Defines the program Id for which the list of commission rates ought to be generated

Response

Property Type Description
RateCollection Array of Rate List of all rates

Rate

Property Type Description
LinkNumber Integer The number of the creative. Together with the program Id and the LinkType, this identifies a single creative
LinkType Enumeration

Defines the type of link of this commission rate.

Possible values are:

  • None
  • Banner
  • Text
  • HTML

ProgramId Integer The program Id for which the list of commission rates has been generated
RateMode Enumeration

Possible values are:

  • None
  • PayPerClick
  • PayPerSale
  • PayPerLead

RateName String Name of the commission rate
RateNumber Integer Number of the commission rate
RateValue DoubleUnit of the commission rate Value of the commission rate
Unit String Unit of the commission rate

GetAllPrograms

Please note:
This method is deprecated. Please use "GetPrograms" instead.

GetMyPrograms

Please note:
This method is deprecated. Please use "GetPrograms" instead.

GetNewPrograms

Please note:
This method is deprecated. Please use "GetPrograms" instead.

GetProgramListByCategory

Please note:
This method is deprecated. Please use "GetPrograms" instead.

SearchMyPrograms

Please note:
This method is deprecated. Please use "GetPrograms" instead.

Statistics

The statistic web services provide the core data of a publisher account. By using this data, publishers can run reports, drill down into the performance of a single program or into their traffic structure via affilinet Sub-IDs. Statistical web services are especially handy for publishers with a huge volume of traffic and related transactions in the affilinet platform.

GetTransactions

Returns a collection of Sales, Leads and ClickOuts, which match the given search criteria. Along with the PageSettings, either the input parameter TransactionIds or StartDate and EndDate must be specified.

Please note:

This webservice returns information about single transactions. For advertisers using affilinet basket tracking, the GetTransactions webservice returns the parameter BasketId, but no data for individual basket items. The BasketId can then be used to draw all relevant basket item infos from the webservice GetBasketItems.

Endpoint

https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_STATS", "https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username'  => $username,
    'Password'  => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set page setting parameters
$pageSettings = array(
    'CurrentPage' => 1,
    'PageSize' => 5,
);
 
// Set transaction query parameters
$startDate = strtotime("-2 weeks");
$endDate = strtotime("today");
$rateFilter = array(
    'RateMode' => 'PayPerSale',
    'RateNumber' => 1
);
$transactionQuery = array(
    'StartDate' => $startDate,
    'EndDate' => $endDate,
    'RateFilter' => $rateFilter,
    'TransactionStatus' => 'All',
    'ValuationType' => 'DateOfRegistration'
);
 
// Send a request to the Publisher Statistics Service
$soapRequest = new SoapClient(WSDL_STATS);
$response = $soapRequest->GetTransactions(array(
    'CredentialToken' => $token,
    'PageSettings' => $pageSettings,
    'TransactionQuery' => $transactionQuery
));
 
// Show response
print_r($response);
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
TransactionQuery required TransactionQuery Here you can specifiy the criteria which shall befulfilled by the transactions you wish to receive.
PageSettings required PageSettings Settings on how big each result set shall be.

TransactionQuery

Parameter Type Description
EndDate DateTime This parameter defines the end date for which the statistics ought to be generated. It is included in the evaluation. Currently only the date part is considered.
NetPriceMax Decimal Lets you restrict the returned transactions to those with a NetPrice of no more than this limit.
NetPriceMin Decimal Lets you restrict the returned transactions to those with a NetPrice of at least this limit or more.
ProgramIds Array of Integer This parameter defines the program IDs for which the statistcs ought to be generated. Array must contain no more than 200 ProgramIds
RateFilter RateFilter

Restricts the returned transactions to only those of the given commission type.

Possible values are:

  • PayPerSale
  • PayPerLead
  • PayPerClickOut

StartDate DateTime This parameter defines the start date for which the statistics ought to be generated. It is included in the evaluation. Currently only the date part is considered.
SubId String Lets you restrict the returned transactions to only those matching this SubId expression. The ‘%’ character can be used for wildcard searching. E.g. ‘%A%B%C%’ returns all transactions which contain ‘A’, ‘B’ and ‘C’ somewhere within their SubId (in this order). This string can hold up to 80 characters incl. wildcards.
TransactionIds Array of Integer This parameter lets you access specific transactions by their unique TransactionId. Up to 100 TransactionIds can be specified with each request. If this parameter is set, all other input parameters of the TransactionQuery and the RateFilter must be left empty. PageSettings still have to be defined.
TransactionStatus Enumeration

Depicts the status of the sale or lead.

Possible values are:

  • Open
  • Confirmed
  • Cancelled
  • All

If not specified, then only open transactions will be returned.

ValuationType Enumeration

This parameter defines the event on which StartDate and EndDate shall operate.

Possible values are:

  • DateOfRegistration: this is when the transaction has been created in our system.
  • DateOfConfirmation: this is the date when the transaction has last been edited by the advertiser. So if you want to know what changed on your transactions yesterday, send a request, where you set StartDate and EndDate to the previous day and ValuationType to DateOfConfirmation. Then you get all transactions, which have been confirmed or cancelled, got an adjusted NetPrice etc... yesterday.

If not specified, “DateOfRegistration” is assumed.

PageSettings

Parameter Type Description
CurrentPage Integer The number of the page of transactions which shall be returned. Must be 1 or bigger.
PageSize Integer The amount of transactions you would like to see per page. Must be between 1 and 100.

RateFilter

Parameter Type Description
RateMode Enumeration

Restricts the returned transactions to only those of the given commission type.

Possible values are:

  • PayPerSale
  • PayPerLead
  • PayPerClickOut

If not specified, “PayPerClickOut” is assumed.

RateNumber Integer Each program can have several sale, lead or clickout rates. With this parameter, you can restrict the output to only those of a given rate. If RateNumber is specified, then RateMode is also required, and we recommend to also specify one ProgramId, because e.g. lead rate number 3 can mean two totally different things in two different

Response

Property Type Description
TotalRecords Integer The total amount of transactions matching the given search criteria.
TransactionCollection Array of Transaction The transactions matching the given search criteria.

Transaction

Property Type Description
BasketInfo BasketInfo Some affilinet advertisers are using basket tracking, so certain transactions can be grouped together in one basket. If this transaction is part of a basket, then this element contains basic information about the basket. Otherwise, it is null.
CancellationReason String If a transaction has been cancelled or the NetPrice has been reduced by the advertiser, he has to specify a reason.
CheckDate DateTime The timestamp when the status of the transaction was last changed.
ClickDate DateTime The timestamp when the click has been recorded, which led to this transaction.
CreativeInfo CreativeInfo Detailed information on the creative, which was used to transfer the customer to the advertiser.
NetPrice Decimal This is what has been transmitted as the net value of the customer’s action. For sale transactions, this is the base for the calculation of the commission. For lead transactions, NetPrice is optional.
ProgramId Integer The ID of the program for which the transaction has been generated.
ProgramTitle String The name of the program.
PublisherCommission Decimal Total amount of money this transaction is worth for the requesting publisher. The currency is tied to the country of the publisher: GBP for English publisher accounts, EUR for all others.
RateInfo RateInfo Detailed information on the rate, which has been used for this transaction.
RegistrationDate DateTime The timestamp when the transaction has been recorded in our database.
SubId String The SubId you have specified with the event, which led to this transaction.
TrackingMethod Enumeration

The recording method, which has been used to create the transaction.

Possible values are:

  • PostClick
  • EfficientReach
  • IP
  • Fingerprint

TransactionId Integer The unique identifier of this transaction within our database.
TransactionStatus Enumeration

The status, which the transaction currently has.

Possible values are:

  • Open
  • Confirmed
  • Cancelled

BasketInfo

Property Type Description
BasketId Integer The unique Id of this basket within the affilinet system. This Id can be used to request the single basket items, using the method “GetBasketItems”.
OpenBasketItemCount Integer The amount of basket items, which have not been cancelled by the advertiser. Only not cancelled basket items are used to calculate the publisher commission.
RegisteredNetPrice Double The total value of the basket, regardless of the status of the contained basket items.
TotalBasketItemCount Integer The total amount of items within this basket, regardless of their status.

RateInfo

Property Type Description
IsTieredCommission Boolean Open transactions, which have a tiered commission, are normally worked on only once each month, and are flagged with this field. For confirmed and cancelled transactions, this flag is NULL.
RateDescription String A description of the applied rate. Normally this is the rate name.
RateMode Enumeration

The mode of the commission.

Possible values are:

  • PayPerSale
  • PayPerLead
  • PayPerClickOut

RateNumber Integer The ID of the applied rate.

CreativeInfo

Property Type Description
CreativeNumber Integer The identifier of the creative which triggered this transaction. ProgramId, CreativeType and CreativeNumber form a unique key within the affilinet platform.
CreativeType Enumeration

The type of the creative which triggered this transaction.

Possible values are:

  • Banner
  • TextLink
  • Form
  • Html
  • BannerRotation
  • BannerOverwrite

GetBasketItems

Some affilinet programs use affilinet basket tracking. This technology allows to track and analyse the shopping activities on item level. GetTransactions delivers transactions - if they are part of a shopping basket, they come with information, to which basket they belong. GetBasketItems can then be used to receive the information on the single items, which have been bought in the basket.

Endpoint

https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php 
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_SERVICE", "https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters
$basketId = ''; // ID of the basket you want to retrieve the items from
 
// Send request to Publisher Statistics Service
$soapRequest = new SoapClient(WSDL_SERVICE);
$response = $soapRequest->GetBasketItems(array(
    'CredentialToken' => $token,
    'BasketId' => $basketId
));
 
// Show response
print_r($response);
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
BasketId required Integer The Id of the basket, whose basket items shall be returned.

Response

Property Type Description
BasketItemCollection Array of BasketItem The transactions matching the given search criteria.

BasketItem

Property Type Description
ArticleNumber String The unique identifier, which the advertiser uses within his own system for this product.
BasketId Integer This Id uniquely identifies across the whole affilinet platform the basket, to which this basket item belongs.
Brand String The make of the bought product.
CancellationReason Enum

Each basket item is not cancelled by default. But under certain circumstances, the advertiser might cancel single basket items. Then the CancellationReason reflects the underlying reason why the advertiser cancelled it.

Possible values are:

  • None
  • FailedCreditCheck
  • SaleCancelledByCustomer
  • ItemReturned
  • ItemOutOfStock
  • DuplicatedOrder
  • BreachOfCampaignTermsAndConditions
  • Other

Category String The category, in which this product is kept in the advertiser’s system.
OriginalQuantity Integer This quantity was specified when this item got created - later changes to the quantity are reflected in the field Quantity.
PositionNumber Integer The position, which this item has within its basket.
ProductName String The title of the product.
Properties Dictionary of [String, String] The advertiser can define up to 5 separate optional parameters for each single basket item. These parameters can be used by the advertiser for all kinds of purposes. Typical use cases are - e.g. in the case of clothing - size, colour, material,...
Quantity Integer/td> The current quantity of this article within this basket. Based on Quantity and SinglePrice, the net price is calculated, which is used to calculate the publisher’s commission.
RateInfo RateInfo Information on the rate, which is used to remunerate this basket item.
SinglePrice Decimal The price, which one article of this ArticleNumber costs. Based on Quantity and SinglePrice, the net price is calculated, which is used to calculate the publisher’s commission.
Status Enum

The current status of this basket item.

Possible values are:

  • NotCancelled
  • Cancelled

TotalPrice Decimal The total value of this basket item, calculated as Quantity * SinglePrice.
TransactionId Integer Internally, this basket item belongs to a transaction. This is that transaction’s Id.

RateInfo

Property Type Description
IsTieredRate Bool Indicates whether or not the program is using a tiered rate system.
RateDescription String The description of the rate. In most cases, it is the name of the default rate.
RateMode Enumeration

The mode of the commission.

Possible values are:

  • PayPerSale
  • PayPerLead
  • PayPerClickOut

RateNumber Integer The identifier of the applied rate.
RateValue Double The value of this rate. If the rate mode is PayPerSale, this is a percentage value, otherwise it is an absolute monetary value.

GetDailyStatistics

This method is used to generate a detailed statistics per day for a specific publisher.

Endpoint

https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php 
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_STATS", "https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl");
 
/ Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));  
 
// Set parameters
$startDate = strtotime("-1 week");
$endDate = strtotime("today");
$params = array(
    'StartDate' => $startDate,
    'EndDate' => $endDate,
    'ProgramId' => '0',
    'SubId' => '',
    'ProgramTypes' => 'All',
    'ValuationType' => 'DateOfRegistration'
);
 
// Send request to Publisher Statistics Service
$soapRequest = new SoapClient(WSDL_STATS);
$response = $soapRequest->GetDailyStatistics(array(
    'CredentialToken' => $token,
    'GetDailyStatisticsRequestMessage' => $params
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.PublisherStatisticsWebservice; ("https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access
    string Username   = "";
    // Insert the publisher web services password for access
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the parameters to get the result    
    DateTime startDate = DateTime.Now.AddMonths(-2);
    DateTime endDate = DateTime.Now;
    int programId = 0;
    string subId = "";
    DailyStatistics myResult = GetDailyStatistics(myToken, programId, startDate, endDate, ProgramTypes.All, ValuationType.DateOfRegistration, subId);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;         
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static DailyStatistics GetDailyStatistics(string token, int programid,DateTime startDate,DateTime endDate, ProgramTypes programtypes, ValuationType DateOfRegistration, string subid)
{
 PublisherStatistics pubstatistic = new PublisherStatistics();
 GetDailyStatisticsRequestMessage gdsrqmess = new GetDailyStatisticsRequestMessage();
 gdsrqmess.ProgramId = programid;
 gdsrqmess.StartDate = startDate;
 gdsrqmess.EndDate = endDate;
 gdsrqmess.ProgramTypes = programtypes;
 gdsrqmess.ValuationType = DateOfRegistration;
 gdsrqmess.SubId = subid;
 return pubstatistic.GetDailyStatistics(token, gdsrqmess);        
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
GetDailyStatistics
RequestMessage required
GetDailyStatistics
RequestMessage
The object which contains the search parameters

GetDailyStatisticsRequestMessage

Parameter Type Description
StartDate required DateTime This parameter defines the start date for which the statistics ought to be generated. It is included in the evaluation
EndDate required DateTime This parameter defines the end date for which the statistics ought to be generated. It is included in the evaluation
SubId required String

This parameter specifies the SubID for which the statistics ought to be generated.

Possible values are:

  • “”: if no value is assigned, the SubId parameter is ignored
  • SubId: records in which the SubID is exactly the assigned value are returned
  • %SubId%: records which contain the assigned value in its SubID are returned
  • %SubId: records in which the SubID ends with the assigned value are returned
  • SubId%: records in which the SubID begins with the assigned value are returned

ProgramTypes required Enumeration

This parameter defines the commission type of the requested statistics.

Possible values are:

  • None
  • PayPerClick
  • PayPerSaleLead
  • CombinedProgram

ValuationType required Enumeration

This parameter defines the event on which the valuation should be based on.

Possible values are:

  • DateOfRegistration
  • DateOfConfirmation

ProgramId required Integer This parameter defines the program ID for which the daily statistcs ought to be generated.

Response

Property Type Description
DailyStatisticsRecord Array of DailyStatisticsRecord Set of statistics records, one for each day of the requested timespan
TOTAL DailyStatisticsRecord Sum of all commissions of returned records

DailyStatisticsRecord

Property Type Description
Date DateTime Date of record
TotalCommission Decimal Total amount of earnings
TotalOpenCommission Decimal Total amount of pending commissions
PayPerSaleLead CommissionSummary Summary of commission information regarding pay per lead / sale
CombinedPrograms CommissionSummary Summary of commission information regarding combined programs
PayPerClick PayPerClick Summary of commission regarding clicks

CommissionSummary

Property Type Description
CancelledSales Integer Total number of cancelled sales
Clicks Integer Total number of clicks
Commission Decimal Total amount of earnings
ConfirmedSales Integer Total number of confirmed sales
OpenCommission Decimal Total amount of pending commissions
OpenSales Integer Total number of open sales
Views Integer Total number of views

PayPerClick

Property Type Description
Clicks Integer Total number of clicks
Commission Decimal Total amount of earnings
Views Integer Total number of views

GetProgramStatistics

This method is used to generate a detailed program statistics for a specific publisher.

Endpoint

https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_STATS", "https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username'  => $username,
    'Password'  => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set params
$startDate = strtotime("-1 week");
$endDate = strtotime("today");
$programIds = array('0');
$params = array(
    'StartDate' => $startDate,
    'EndDate' => $endDate,
    'ProgramStatus' => 'Active',
    'ProgramIds' => $programIds,
    'SubId' => '',
    'ProgramTypes' => 'All',
    'ValuationType' => 'DateOfRegistration'
);
 
// Send request to Publisher Statistics Service
$soapRequest = new SoapClient(WSDL_STATS);
$response = $soapRequest->GetProgramStatistics(array(
      'CredentialToken' => $token,
      'GetProgramStatisticsRequestMessage' => $params
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
protected void LoadWebService()
{            
    // first create the Web References
    // using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    // using Affilinet.PublisherStatisticsWebservice; ("https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access
    string Username   = "";
    // Insert the publisher web services password for access
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the parameters to get the result    
    DateTime startDate = DateTime.Now.AddMonths(-2);
    DateTime endDate = DateTime.Now;
    int[] programIds = { };
    string subId = "";
    ProgramStatistics myResult = GetProgramStatistics(myToken, startDate, endDate, programIds, ProgramStatus.Active, ProgramTypes.All, ValuationType.DateOfRegistration, subId);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;        
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static ProgramStatistics GetProgramStatistics(string token,DateTime startdate,DateTime enddate, int[] programids, ProgramStatus programstatus, ProgramTypes programtypes, ValuationType valuationtype, string subid)
{
 PublisherStatistics pubstatistic = new PublisherStatistics();
 GetProgramStatisticsRequestMessage gpsrqmess = new GetProgramStatisticsRequestMessage();
 gpsrqmess.StartDate=  startdate;
 gpsrqmess.EndDate = enddate;
 gpsrqmess.ProgramIds  = programids ;
 gpsrqmess.ProgramStatus = programstatus;
 gpsrqmess.ProgramTypes = programtypes;
 gpsrqmess.ValuationType = valuationtype;
 gpsrqmess.SubId = subid;           
 return pubstatistic.GetProgramStatistics(token, gpsrqmess);          
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
GetDailyStatistics
RequestMessage required
GetProgramStatistics
RequestMessage
The object which contains the search parameters

GetProgramStatisticsRequestMessage

Parameter Type Description
StartDate required DateTime This parameter defines the start date for which the statistics ought to be generated. It is included in the evaluation
EndDate required DateTime This parameter defines the end date for which the statistics ought to be generated. It is included in the evaluation
SubId required String

This parameter specifies the SubID for which the statistics ought to be generated.

Possible values are:

  • “”: if no value is assigned, the SubId parameter is ignored
  • SubId: records in which the SubID is exactly the assigned value are returned
  • %SubId%: records which contain the assigned value in its SubID are returned
  • %SubId: records in which the SubID ends with the assigned value are returned
  • SubId%: records in which the SubID begins with the assigned value are returned

ProgramTypes required Enumeration

This parameter defines the commission type of the requested statistics.

Possible values are:

  • None
  • PayPerClick
  • PayPerSaleLead
  • CombinedProgram

ValuationType required Enumeration

This parameter defines the event on which the valuation should be based on.

Possible values are:

  • DateOfRegistration
  • DateOfConfirmation

ProgramIds required Array of Integer This parameter defines the program ID for which the program statistcs ought to be generated.
ProgramStatus required Enumeration

This parameter defines the status in which the returned programs ought to be.

Possible values are:

  • Active
  • All
  • Inactive

Response

Property Type Description
PayPerClickStatistics ProgramStatisticSet Statistical information on pay per click programs matching the submitted search criteria
PayPerSaleLeadStatistics ProgramStatisticSet Statistical information on pay per sale or sale per lead programs matching the submitted search criteria
StatisticsOverview StatisticsOverview Summarzied information across all found records.
CombinedProgramStatistics ProgramStatisticSet Statistical information on combined programs matching the submitted search criteria

ProgramStatisticSet

Property Type Description
StatisticsOverview StatisticsOverview Aggregated statistical information
StatisticsRecords Array of ProgramStatisticsRecord Detailed statistical information

StatisticsOverview

Property Type Description
Clicks Integer Total number of clicks
Commission Decimal Total amount of earnings
OpenCommission Decimal Total commission in unconfirmed (pending) sales or leads
Sales Integer Total amount of generated sales
Views Integer Total amount of generated views

ProgramStatisticsRecord

Property Type Description
CancelledSales Integer Total number of cancelled sales
Clicks Integer Total number of clicks
Clickthrough Decimal Number of clicks devided by the number of views
Commission Decimal Total amount of earnings
OpenCommission Decimal Total commission in unconfirmed (pending) sales or leads
OpenSales Integer Total number of open sales
ProgramId Integer ID of the advertiser
ProgramTitle String Name of the advertiser
Sales Integer Total amount of generated sales
Views Integer Total amount of generated views
CommissionRates CommissionRates Detailed information on the applicable commission rates
StatisticsOverview StatisticsOverview Aggregated statistical information

CommissionRates

Property Type Description
PayPerClick CommissionRateValues Information on pay per click commission rate
PayPerSale CommissionRateValues Information on pay per sale commission rate
PayPerLead CommissionRateValues Information on pay per lead commission rate

CommissionRateValues

Property Type Description
MaxRate Decimal Maximum amount of money per transaction. If 0 is returned, this means that MaxRate = MinRate.
MinRate Decimal Minimum commission of this rate

GetSalesLeadsStatistics

This method is used to generate a detailed sales / leads statistics for specified programs.

Endpoint

https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_STATS", "https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl");
 
// Set parameters
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters
$startDate = strtotime("-2 weeks");
$endDate = strtotime("today");
$programIds = array('0');
$params = array(
    'StartDate' => $startDate,
    'EndDate' => $endDate,
    'TransactionStatus' => 'All',
    'ProgramIds' => $programIds,
    'SubId' => '',
    'ProgramTypes' => 'All',
    'MaximumRecords' => '10',
    'ValuationType' => 'DateOfRegistration'
);
 
// Send a request to the Publisher Statistics Service
$soapRequest = new SoapClient(WSDL_STATS);
$response = $soapRequest->GetSalesLeadsStatistics(array(
    'CredentialToken' => $token,
    'GetSalesLeadsStatisticsRequestMessage' => $params
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
protected void LoadWebService()
{            
    // first create the Web References
    // using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    // using Affilinet.PublisherStatisticsWebservice; ("https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access the live data
    string Username   = "";
    // Insert the publisher web services password for access the live data
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the parameters to get the result    
    DateTime startDate = DateTime.Now.AddMonths(-2);
    DateTime endDate = DateTime.Now;
    int[] programIds = {  };
    string subId = "";
    SalesLeadsStatistics myResult = GetSalesLeadsStatistics(myToken, startDate, endDate, 999, programIds, ProgramTypes.All, subId, TransactionStatus.Open, ValuationType.DateOfRegistration);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;
    
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static SalesLeadsStatistics GetSalesLeadsStatistics(string token, DateTime startdate,DateTime enddate, int maximumrecords, int[] programids, ProgramTypes programtypes, string subid, TransactionStatus transactionstatus, ValuationType valuationtype)
{
   PublisherStatistics pubstatistic = new PublisherStatistics();
    GetSalesLeadsStatisticsRequestMessage gslsrqmess = new GetSalesLeadsStatisticsRequestMessage();
    gslsrqmess.StartDate = startdate;
    gslsrqmess.EndDate = enddate;
    gslsrqmess.MaximumRecords = maximumrecords;
    gslsrqmess.ProgramIds = programids;
    gslsrqmess.ProgramTypes = programtypes;
    gslsrqmess.SubId = subid;
    gslsrqmess.TransactionStatus = transactionstatus;
    gslsrqmess.ValuationType = valuationtype;
   return pubstatistic.GetSalesLeadsStatistics(token,gslsrqmess);         
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
GetSalesLeadsStatistics
RequestMessage required
GetSalesLeadsStatistics
RequestMessage
The object which contains the search parameters

GetSalesLeadsStatisticsRequestMessage

Parameter Type Description
StartDate required DateTime This parameter defines the start date for which the statistics ought to be generated. It is included in the evaluation
EndDate required DateTime This parameter defines the end date for which the statistics ought to be generated. It is included in the evaluation
SubId required String

This parameter specifies the SubID for which the statistics ought to be generated.

Possible values are:

  • “”: if no value is assigned, the SubId parameter is ignored
  • SubId: records in which the SubID is exactly the assigned value are returned
  • %SubId%: records which contain the assigned value in its SubID are returned
  • %SubId: records in which the SubID ends with the assigned value are returned
  • SubId%: records in which the SubID begins with the assigned value are returned

MaximumRecords required Integer The maximum amount of results to be returned
TransactionStatus required Enumeration

Depicts the status of the sale or lead.

Possible values are:

  • Open
  • Confirmed
  • Cancelled
  • All

ProgramTypes required Enumeration

This parameter defines the commission type of the requested statistics.

Possible values are:

  • None
  • PayPerClick
  • PayPerSaleLead
  • CombinedProgram

ValuationType required Enumeration

This parameter defines the event on which the valuation should be based on.

Possible values are:

  • DateOfRegistration
  • DateOfConfirmation

Response

Property Type Description
TotalCancelled Decimal Total amount of cancelled commissions
TotalConfirmed Decimal Total amount of confirmed commissions
TotalOpen Decimal Total amount of open commissions
SalesLeadsStatisticsRecord Array of SalesLeadsStatisticsRecord Detailed information on each sale or lead

SalesLeadsStatisticsRecord

Property Type Description
CheckDate DateTime Date when the transaction was checked. If the sale/lead is open, then 0001-01-01T00:00:00 is returned.
Commission Decimal Commission of the transaction
CommissionDescription String Further information regarding commission of the current transaction
Date DateTime Date of current transaction
Information String Further information regarding the transaction
ProgramId Integer ID of the advertiser
ProgramTitle String Name of the advertiser
SubId String SubID related to the transaction
TransactionStatus Enumeration

Depicts the status of the sale or lead.

Possible values are:

  • Open
  • Confirmed
  • Cancelled
  • All

GetSubIdStatistics

This method is used to generate a detailed SubID statistics for a specified publisher.

Endpoint

https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_STATS", "https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters
$startDate = strtotime("-2 weeks");
$endDate = strtotime("today");
$programIds = array('0');
$params = array(
    'StartDate' => $startDate,
    'EndDate' => $endDate,
    'ProgramIds' => $programIds,
    'ProgramTypes' => 'All',
    'SubId' => '',
    'MaximumRecords' => '100',
    'TransactionStatus' => 'All',
    'ValuationType' => 'DateOfRegistration'
);
 
// Send a request to the Publisher Statistics Service
$soapRequest = new SoapClient(WSDL_STATS);
$response = $soapRequest->GetSubIdStatistics(array(
    'CredentialToken' => $token,
    'GetSubIdStatisticsRequestMessage' => $params
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.PublisherStatisticsWebservice; ("https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access the live data
    string Username   = "";
    // Insert the publisher web services password for access the live data
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the parameters to get the result    
    DateTime startDate = DateTime.Now.AddMonths(-2);
    DateTime endDate = DateTime.Now;
    int[] programIds = { 2897 };
    string subId = "";
    SubIdStatisticsRecords myResult = GetSubIdStatistics(myToken, startDate, endDate, 999, programIds, ProgramTypes.All, subId, TransactionStatus.All, ValuationType.DateOfRegistration);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;        
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static SubIdStatisticsRecords GetSubIdStatistics(string token, DateTime startdate, DateTime enddate, int maximumrecords, int[] programids, ProgramTypes programtypes, string subid, TransactionStatus transactionstatus,ValuationType valuationtype)
{
 PublisherStatistics pubstatistic = new PublisherStatistics();
    GetSubIdStatisticsRequestMessage gsisreqmess = new GetSubIdStatisticsRequestMessage();
 gsisreqmess.StartDate = startdate;
 gsisreqmess.EndDate = enddate;
 gsisreqmess.MaximumRecords = maximumrecords;
 gsisreqmess.ProgramIds = programids;
 gsisreqmess.ProgramTypes = programtypes;
 gsisreqmess.SubId = subid;
 gsisreqmess.TransactionStatus = transactionstatus;
 gsisreqmess.ValuationType = valuationtype;
 return pubstatistic.GetSubIDStatistics(token, gsisreqmess);           
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
GetSubIdStatistics
RequestMessage required
GetSalesLeadsStatistics
RequestMessage
This parameter defines the start date for which the statistics ought to be generated. It is included in the evaluation

GetSubIdStatisticsRequestMessage

Parameter Type Description
StartDate required DateTime This parameter defines the start date for which the statistics ought to be generated. It is included in the evaluation
EndDate required DateTime This parameter defines the end date for which the statistics ought to be generated. It is included in the evaluation
SubId required String

This parameter specifies the SubID for which the statistics ought to be generated.

Possible values are:

  • “”: if no value is assigned, the SubId parameter is ignored
  • SubId: records in which the SubID is exactly the assigned value are returned
  • %SubId%: records which contain the assigned value in its SubID are returned
  • %SubId: records in which the SubID ends with the assigned value are returned
  • SubId%: records in which the SubID begins with the assigned value are returned

ValuationType required Enumeration

This parameter defines the event on which the valuation should be based on.

Possible values are:

  • DateOfRegistration
  • DateOfConfirmation

ProgramIds required Array of Integer This parameter defines the program ID for which the program statistcs ought to be generated.
MaximumRecords required Integer The maximum amount of results you want to receive
ProgramTypes required Enumeration

This parameter defines the commission type of the requested statistics.

Possible values are:

  • None
  • PayPerClick
  • PayPerSaleLead
  • CombinedProgram

TransactionStatus required Enumeration

Depicts the status of the sale or lead.

Possible values are:

  • Open
  • Confirmed
  • Cancelled
  • All

Response

Property Type Description
TotalPayment Decimal The total amount of money earned with this SubID
TotalPrice Decimal If a sale was done on the advertiser’s platform, this is the value of the sale
Records Array of SubIdStatisticsRecord The single transactions matching the search criteria

SubIdStatisticsRecord

Property Type Description
CheckDate DateTime Date when the transaction was checked
Commission Decimal Absolute monetary value of this transaction, regardless of the TransactionStatus
Confirmed Decimal Monetary value of this transaction, if it was confirmed
Date DateTime Date of the calculation
Number Integer A unique identifier, which helps us to identify this order, in case the publisher has questions about it.
Price Decimal If a sale was done on the advertiser’s platform, this is the value of the sale
ProgramId Integer ID of the advertiser
ProgramTitle String Name of the advertiser
SubId String The evaluated subID
Transaction String

Type of transaction.

Possible values are:

  • L = Lead
  • S = Sale

TransactionStatus Enumeration

Depicts the status of the sale or lead.

Possible values are:

  • Open
  • Confirmed
  • Cancelled
  • All

GetClicksBySubIdPerDay

Generates a report on clicks for a given program, grouped by SubID and date

Endpoint

https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php 
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_STATS", "https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters
$startDate = strtotime("-2 months");
$endDate = strtotime("today");
$params = array(
    'StartDate' => $startDate,
    'EndDate' => $endDate,
    'UseGrossValues' => true,
    'ProgramId' => '0'
);
 
// Send request to Publisher Statistics Service
$soapRequest = new SoapClient(WSDL_STATS);
$response = $soapRequest->GetClicksBySubIdPerDay(array(
    'CredentialToken' => $token,
    'GetClicksBySubIdPerDayRequestMessage' => $params
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.PublisherStatisticsWebservice; ("https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access
    string Username   = "";
    // Insert the publisher web services password for access
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the parameters to get the result    
    DateTime startDate = DateTime.Now.AddMonths(-2);
    DateTime endDate = DateTime.Now;
    int programId = 0;
    ClicksBySubId myResult = GetClicksBySubIdPerDay(myToken, startDate, endDate, programId, true);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;          
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static ClicksBySubId GetClicksBySubIdPerDay(string token,DateTime startdate,DateTime enddate,int programid,bool usegrossvalue)
{
 PublisherStatistics pubstatistic = new PublisherStatistics();
 GetClicksBySubIdPerDayRequestMessage gcbsipdrqmess = new GetClicksBySubIdPerDayRequestMessage();
 gcbsipdrqmess.StartDate=  startdate;
 gcbsipdrqmess.EndDate = enddate;
 gcbsipdrqmess.ProgramId = programid;
 gcbsipdrqmess.UseGrossValues = usegrossvalue;           
 return pubstatistic.GetClicksBySubIdPerDay(token, gcbsipdrqmess);  
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
GetClicksBySubIdPerDay
RequestMessage required
GetClicksBySubIdPerDay
RequestMessage
The object which contains the search parameters

GetClicksBySubIdPerDayRequestMessage

Parameter Type Description
StartDate required DateTime This parameter defines the start date for which the statistics ought to be generated. It is included in the evaluation
EndDate required DateTime This parameter defines the end date for which the statistics ought to be generated. It is included in the evaluation
UseGrossValues required Boolean Set to „false“ if you want net values
ProgramId required Integer This parameter defines the program ID for which the statistics ought to be generated.

Response

Property Type Description
ClicksBySubIdRecords Array of ClicksBySubIdRecord List of transaction statistics for each subID matching the given search criteria

ClicksBySubIdRecord

Property Type Description
ProgramId Integer ID of the advertiser
ProgramTitle String Name of the advertiser
SubId String SubID related to the click
TransactionCount Integer Amount of transactions that have taken place on that day
TransactionDate DateTime Date when the transaction took place

GetPublisherClicksSummary

This method is used to generate a detailed program statistics for a specific publisher.

Endpoint

https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_STATS", "https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl");
 
// Set credentials
$username = ""; // the publisher ID
$password = ""; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters          
$startDate = strtotime("-2 weeks");
$endDate = strtotime("today");
$params = array(
    'ProgramId' => '0',
    'StartDate' => $startDate,
    'EndDate' => $endDate,
    'SubId' => ''
);
 
// Send request to Publisher Statistics Service
$soapRequest = new SoapClient(WSDL_STATS);
$response = $soapRequest->GetPublisherClicksSummary(array(
    'CredentialToken' => $token,
    'GetPublisherClicksSummaryRequestMessage' => $params
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.PublisherStatisticsWebservice; ("https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access
    string Username   = "";
    // Insert the publisher web services password for access
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the parameters to get the result    
    DateTime startDate = DateTime.Now.AddMonths(-2);
    DateTime endDate = DateTime.Now;
    int programId = 0;
    PublisherClicksSummary myResult = GetPublisherClicksSummary(myToken, startDate, endDate, programId);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;           
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static PublisherClicksSummary GetPublisherClicksSummary(string token, DateTime startdate, DateTime enddate, int programid)
{
 PublisherStatistics pubstatistic = new PublisherStatistics();
 GetPublisherClicksSummaryRequestMessage gpcsrqmess = new GetPublisherClicksSummaryRequestMessage();
 gpcsrqmess.StartDate = startdate;
 gpcsrqmess.EndDate = enddate;
 gpcsrqmess.ProgramId = programid;            
 return pubstatistic.GetPublisherClicksSummary(token,gpcsrqmess);
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
GetPublisherClicksSummary
RequestMessage required
GetPublisherClicksSummary
RequestMessage
The object which contains the search parameters

GetPublisherClicksSummaryRequestMessage

Parameter Type Description
StartDate required DateTime This parameter defines the start date for which the statistics ought to be generated. It is included in the evaluation
EndDate required DateTime This parameter defines the end date for which the statistics ought to be generated. It is included in the evaluation
SubId required String

This parameter specifies the SubID for which the statistics ought to be generated.

Possible values are:

  • “”: if no value is assigned, the SubId parameter is ignored
  • SubId: records in which the SubID is exactly the assigned value are returned
  • %SubId%: records which contain the assigned value in its SubID are returned
  • %SubId: records in which the SubID ends with the assigned value are returned
  • SubId%: records in which the SubID begins with the assigned value are returned

ProgramId required Integer ID of the advertiser. This parameter defines the program ID for which the statistics ought to be generated.

Response

Property Type Description
ClicksTotal Integer Total amount of clicks
PublisherClicksStatusRecords Array of PublisherClicksStatus Aggregated information on each click status

PublisherClicksStatus

Property Type Description
Percentage Decimal Depicts what percentage of all clicks have this status
Quantity Integer Absolute number of clicks with this status
ClickStatus Enumeration

Information on the status of the click.

Possible values are:

  • Ok
  • NoReferer
  • QueueClick
  • NoUrl
  • DoubleClick
  • NoCredit
  • NoPartnership

GetPublisherStatisticsPerClick

This method is used to generate a clicks data statistics for a specified publisher.

Endpoint

https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl

Sample Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
 
// Set webservice endpoints
define("WSDL_LOGON", "https://api.affili.net/V2.0/Logon.svc?wsdl");
define("WSDL_STATS", "https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl");
 
// Set credentials
$username = ''; // the publisher ID
$password = ''; // the publisher web services password
 
// Send a request to the Logon Service to get an authentication token
$soapLogon = new SoapClient(WSDL_LOGON);
$token = $soapLogon->Logon(array(
    'Username' => $username,
    'Password' => $password,
    'WebServiceType' => 'Publisher'
));
 
// Set parameters
$startDate = strtotime("-1 day");
$endDate = strtotime("today");
$params = array(
    'ProgramId' => '0',
    'StartDate' => $startDate,
    'EndDate' => $endDate,
    'SubId' => '',
    'SortFilter' => 'Time'
);    
 
// Send request to Publisher Statistics Service
$soapRequest = new SoapClient(WSDL_STATS);
$response = $soapRequest->GetPublisherStatisticsPerClick(array(
    'CredentialToken' => $token,
    'GetPublisherStatisticsPerClickRequestMessage' => $params
));
 
// Show response
print_r($response);
        
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
protected void LoadWebService()
{            
    // first create the Web References
    using Affilinet.LogonWebservice; ("https://api.affili.net/V2.0/Logon.svc?wsdl")
    using Affilinet.PublisherStatisticsWebservice; ("https://api.affili.net/V2.0/PublisherStatistics.svc?wsdl")    
 
    #region Parameters for the authentification token
    // Insert the publisher ID for access
    string Username   = "";
    // Insert the publisher web services password for access
    string Password   = "";
    #endregion
 
    string myToken = GetAuthentificationToken(Username, Password, WebServiceTypes.Publisher);
    
    // insert the parameters to get the result    
    DateTime startDate = DateTime.Now.AddMonths(-2);
    DateTime endDate = DateTime.Now;
    int programId = 0;
    string subId = "";
    PublisherClicks myResult = GetPublisherStatisticsPerClick(myToken, programId, startDate, endDate, subId, SortFilter.Time);
}
 
public static string GetAuthentificationToken(string username, string password, WebServiceTypes WSType)
{
    Logon logonRequest = new Logon();
    logonRequest.Username = username;
    logonRequest.Password = password;
    logonRequest.WebServiceType = WSType;
 
    Authentication logonService = new Authentication();
    return logonService.Logon(logonRequest);
}
 
public static PublisherClicks GetPublisherStatisticsPerClick(string token,int programid, DateTime startdate, DateTime enddate, string subid, SortFilter sortfilter)
{
 PublisherStatistics pubstatistic = new PublisherStatistics();
 GetPublisherStatisticsPerClickRequestMessage gpspcRqMess = new GetPublisherStatisticsPerClickRequestMessage();
 gpspcRqMess.ProgramId = programid;
 gpspcRqMess.StartDate = startdate;
 gpspcRqMess.EndDate = enddate;
 gpspcRqMess.SubId = subid;
 gpspcRqMess.SortFilter= sortfilter;
 return pubstatistic.GetPublisherStatisticsPerClick(token, gpspcRqMess);
}
        

Request Parameters

Parameter Type Description
CredentialToken required String The authentification token you receive from the method “Logon”
GetPublisherStatisticsPerClick
RequestMessage required
GetPublisherStatisticsPerClick
RequestMessage
The object which contains the search parameters

GetPublisherStatisticsPerClickRequestMessage

Parameter Type Description
StartDate required DateTime This parameter defines the start date for which the statistics ought to be generated. It is included in the evaluation
EndDate required DateTime This parameter defines the end date for which the statistics ought to be generated. It is included in the evaluation
SubId required String

This parameter specifies the SubID for which the statistics ought to be generated.

Possible values are:

  • “”: if no value is assigned, the SubId parameter is ignored
  • SubId: records in which the SubID is exactly the assigned value are returned
  • %SubId%: records which contain the assigned value in its SubID are returned
  • %SubId: records in which the SubID ends with the assigned value are returned
  • SubId%: records in which the SubID begins with the assigned value are returned

ProgramId required Integer ID of the advertiser. This parameter defines the program ID for which the statistics ought to be generated.
SortFilter required Enumeration

Criteria by which the results should be sorted.

Possible values are:

  • Time
  • Ip
  • Url

Response

Property Type Description
PublisherClicksRecords Array of PublisherClicksRecord Array of all clicks matching the given search criteria

PublisherClicksRecords

Property Type Description
CreativeNumber Integer The ID of the creative, identifying this creative among all creatives of this program
Date DateTime Date when the click was performed
Ip String IP from which the click came
ProgramId Integer ID of the advertiser
ProgramTitle String Name of the advertiser
Referer String URL from which the user was coming
SubId String

This parameter specifies the SubID for which the statistics ought to be generated.

Possible values are:

  • “”: if no value is assigned, the SubId parameter is ignored
  • SubId: records in which the SubID is exactly the assigned value are returned
  • %SubId%: records which contain the assigned value in its SubID are returned
  • %SubId: records in which the SubID ends with the assigned value are returned
  • SubId%: records in which the SubID begins with the assigned value are returned

Time String The time when the click was made
CreativeType Enumeration

The type of the creative on which was clicked.

Possible values are:

  • Banner
  • TextLink
  • Form
  • Html
  • BannerRotation
  • BannerOverwrite

ClickStatus Enumeration

Information on the status of the click.

Possible values are:

  • Ok
  • NoReferer
  • QueueClick
  • NoUrl
  • DoubleClick
  • NoCredit
  • NoPartnership

GetStatisticsPerProgram

Please note:
This method is deprecated. Please use "GetProgramStatistics" instead.

GetSalesLeadsBySubIdPerDay

Please note:
This method is deprecated. Please use "GetTransactions" instead.