Documentation

Introduction

How to start?

The integration of affilinet's Mobile Ad SDK is straight forward. Just download the Mobile SDK Package for iOS or Android and go through this documentation to find all the necessary info.

What else you need to consider?

Integrating the affilinet Mobile Ad SDK is just a first step, mainly done by development. Please consider also to:

  • Assign creatives to the publisher containers, integrated into the app, via the publisher portal
  • Apply for more programs and product feeds to get the most out of your mobile ad and product data delivery

Considerations on the Demo app

Inside the demo app code (Android, iOS) you need to add your own Publisher ID and Product Data Webservice Password. Note: Use the Product Data WS password, not the publisher WS password! Please also adjust the Platform (iOS: CountryCodeDE, Android: Platform.DE) your publisher belongs to accordingly.

in iOS
AppDelegate.m
1
2
3
4
ANPublisherAccount *account = [[ANPublisherAccount alloc] init];
account.accountID = {PUBLISHER-ID};
account.webServicePassword = "{PRODUCT-DATA-WEBSERVICE-PASSWORD}"; 
[[ANSession sharedInstance] openWithAccount:account andCountryCode:CountryCodeDE];
in Android
MainActivity.java
1
2
3
4
5
6
7
Account account = new PublisherAccount({PUBLISHER-ID},"{PRODUCT-DATA-WEBSERVICE-PASSWORD}"); 
Session session = Session.getInstance();
try {
    session.open(getApplicationContext(), account, Platform.DE);
} catch (Exception e) {
    Log.v("affilinet", e.getMessage());
}

iOS Publisher SDK

Requirements

  • iOS 6 or later
  • A valid affilinet publisher account
  • Add the AffilinetPublisher.framework to the project directly or by adding pod 'AffilinetPublisher' to your podfile if using cocoapods
  • libxml2.dylib must be added to the "Link Binary With Libraries" section of the "Build Phases" tab of the project settings
  • "${SDK_ROOT}/usr/include/libxml2" must be added to the "Header Search Paths" of the "Build Settings" tab of the project settings
  • "-ObjC" flag must be added to the "Other Linker Flags" entry of the "Build Settings" tab of the project settings

How to use

  1. In the Build Phases tab of the project settings add the libxml2.dylib to the Link Binary With Libraries section
  2. In the Build Settings tab of the project settings add to the Header Search Paths the following path: ${SDK_ROOT}/usr/include/libxml2
  3. Add the AffilinetPublisher.framework to the project directly or by adding pod 'AffilinetPublisher' to your podfile if using cocoapods
  4. Compile and run

Class Overview

General Classes

ANSession

The publisher must always open a session before doing any type of requests with affilinet backend. The ANSession object should be used as a singleton throught the whole application and is responsible to do all the requests to affilinet.

Attribute Type Description Mandatory
account ANPublisherAccount The session’s account YES
platform ANPlatform The session’s country-dependent platform. Not mandatory, if used via webservices YES
(^onRequestResponse)(ANRequest* , ANRequestResponse *) NSBlock Request Response block  
(^onRequestsError)(NSError *) NSBlock Requests Error block  
(^onRequestsFinished)(void) NSBlock Requests Finished block  
Method Returns Description
openWithAccount:(ANPublisherAccount*) andCountryCode:(ANCountryCode) void Opens a session with the specified account and country code
executeRequests:(NSArray *) void Executes the requests in the input array
ANPublisherAccount

The ANPublisherAccount class specifies the account to be used by the SDK on all requests to affilinet.

Attribute Type Description Mandatory
accountID NSNumber The publisher's account id YES
webServicePassword NSString The publisher's product data webservice account password (only required if webservice requests will be made) NO
Method Returns Description
publisherAccountWithID:(NSNumber*) ANPublisherAccount Class Constructor
ANPlatform

The ANPlatform specifies a country-dependent platform (with a country code) that can be later used to open a session with the correct affilinet domain.

Method Returns Description
initWithCountryCode:(ANCountryCode) ANPlatform The initialization method of the class
getStringValue NSString Gets the country code as a string value
getDomain NSString Gets the country affilinet domain
ANCountryCode

The ANCountryCode is a enumeration that makes it easier to specify a Country Code.

ANCountryCodeDE
ANCountryCodeAT
ANCountryCodeCH
ANCountryCodeGB
ANCountryCodeFR
ANCountryCodeES
ANCountryCodeNL
ANCountryCodeBE
ANCountryCodeLU
ANRequest

All requests to affilinet (either by javascript or webservice calls) are specified by ANRequest objects. The ANRequest class should not be used directly but instead it’s supposed to be subclassed (one can look at it as an abstract class in java, although there is no such concept in Objective-C).

Attribute Type Description Mandatory
session ANSession The session YES
protocol ANRequestProtocol The request web protocol YES
Method Returns Description
initWithSession:(ANSession*) ANRequest Initializes a new instance of a request
protocolAsString NSString Returns the current web protocol as a string (https or http)
ANRequestProtocol

The ANRequestProtocol is a enumeration that makes it easier to specify a protocol.

ANRequestProtocolHTTP
ANRequestProtocolHTTPS
ANCurrency

An ANCurrency represents a currency

Method Returns Description
initWithStringCode:(NSString *) currencyCode ANCurrency Initializes a new instance of a currency using a 3-letter currency code. Some currency codes are predefined with prefix `kANCurrencyCode`, but any 3-letter code can be used.
stringValue NSString Returns the current currency code as a string

Ad Views

ANAd

The ANAd class represents an advertisement. Please note, that you should not use the ANAd class directly, instead the ANContainerAd extending class should be used.

Attribute Type Description Mandatory
session ANSession The session YES
refreshInterval NSInteger Refresh interval for this ad in seconds. Can be set during initialization. Default 30s. Minimum value 10s. Readonly. YES
size ANAdSize The Ad Size YES
Method Returns Description
initWithSession:(ANSession*) ANAd Initializes a new instance of an ad
initWithSession:(ANSession*) refreshInterval:(NSInteger) ANAd Initializes a new instance of an ad with a custom refresh interval. A value of 0 will disable auto refresh. Non-zero values below the minimum refresh interval of 10 seconds will be set to 10 seconds.
getCGSize CGSize Returns the size of the advertisement
ANContainerAd

The ANContainerAd represents a container ad. This class extends #ANAd and inherits all it's methods and attributes.

Attribute Type Description Mandatory
pcid NSString Unique publisher container identifier. Copy from container code provided in publisher login area. YES
subid NSString Ad space secondary identifier NO
customSize CGSize Defines a custom size for Ad when ANAdSize = ANCustomAdSize. Needs to be a non-zero rect. Ignored for any other value of ANAdSize. YES, when ANAdSize = ANCustomAdSize
ANAdSize

The ANAdSize is a enumeration that represents specific ad sizes

Type Size
ANFullSizeBanner 468 x 6o
ANMediumRectangle 300 x 250
ANWideSkyscrapper 160 x 600
ANSkyscrapper 120 x 600
ANLeaderboard 728 x 90
ANSquareBanner 250 x 250
ANFeaturePhoneMediumBanner 168 x 28
ANFeaturePhoneLargeBanner 216 x 36
ANSmartphoneBanner 300 x 50
ANSmartphoneWideBanner 320 x 50
ANCustomAdSize
ANAdDisplayView

The ANAdDisplayView extends an UIView and is a container to show advertisements. When the user presses on the ad, the user is redirected to the ad target link in the default operating system browser.

Attribute Type Description
delegate ANAdDisplayViewDelegate Delegate
Method Returns Description
refresh Triggers a refresh of the contained ANAd. Will have no effect on the ad if it's been refreshed within the last 10 seconds. If ad is set to autorefresh, will reset the refresh timer.

Product Data Webservice Requests

For detailed information about webservice, please also consult the Product Data Webservice GET Documentation

ANGetShopListRequest

The ANGetShopListRequest extends an ANRequest and is used to retrieve a list of shops. Shops represent the different product feeds of an advertiser.

Attribute Type Description Mandatory
currentPage NSUInteger Current page to retrieve NO
pageSize NSUInteger Number of shops per page NO
query NSString A query to filter results NO
updatedAfter NSDate Returns only shops updated after the specified date NO
logoScale ANWSShopLogoScale The desired logo size NO
ANGetCategoryListRequest

The ANGetCategoryListRequest extends an ANRequest and is used to retrieve a list of a shop categories.

Attribute Type Description Mandatory
shopId NSInteger Shop ID to retrieve the categories from YES
currentPage NSUInteger Current page to retrieve NO
pageSize NSUInteger Number of categories per page NO
ANGetProductsRequest

The ANGetShopListRequest extends an ANRequest and is used to retrieve the details of the specified product IDs.

Attribute Type Description Mandatory
productIds NSArray An array of NSString with the product IDs to retrieve YES
currentPage NSUInteger Current page to retrieve NO
pageSize NSUInteger Number of shops per page NO
logoScales NSArray An array of ANWSShopLogoScale with the desired shop logo sizes NO
imageScales NSArray ANWSProductImageScale with the desired product image sizes NO
ANSearchProductsRequest

The ANGetShopListRequest extends an ANRequest and is used to retrieve a list of products that matches the search criteria

Attribute Type Description Mandatory
currentPage NSUInteger Current page to retrieve NO
pageSize NSUInteger Number of shops per page NO
logoScales NSArray An array of ANWSShopLogoScale with the desired shop logo sizes NO
imageScales NSArray ANWSProductImageScale with the desired product image sizes NO
query NSString The keyword(s) you want the products to match. Can be any length. The following search operators are supported:
  • AND (both query tokens must be contained in the product, but not necessarily next to one another)
  • OR (any of the query tokens must be contained in the product)
  • NOT (e.g. with "ipod AND NOT nano", you will get products, which match the query "ipod", but at the same time don’t match "nano")
  • " (phrase match: all query tokens enclosed with quotes must be contained in the found products in that order)
  • () (Parentheses, to group expressions)

The wildcard * is supported for suffix matching, that is: a query bott* will match products that contain the word "bottle" or the word "bottom".

Search operators AND, OR and NOT must be in capital letters.

Example: "apple ipod" ((touch OR classic) NOT nano) AND "32 GB"

query, categoryIds or filterQueries need to be set in request
shopIds NSArray An array of NSString that specifies the shop IDs on where to search the products NO
categoryIds NSArray An array of NSString that specifies the category IDs on where to search the products query, categoryIds or filterQueries need to be set in request
useAffilinetCategories BOOL Specifies wether to include or exclude the affilinet categories from the search NO
excludeSubCategories BOOL Specifies wether to include or exclude sub categories form the search NO
withImageOnly BOOL Specifies wether to return only products with images or without NO
minimumPrice double Minimum price of the products NO
maximumPrice double Maximum price of the products NO
facetFields NSArray An array os NSString that specifies a set of facet fields NO
facetValueLimit NSInteger Specifies the limit of the facet values NO
shopIdMode ANWSShopIdMode Shop Id Mode NO
sortBy ANWSProductSortBy Sort By NO
sortOrder ANWSSortOrder Sort order NO
filterQueries NSArray An array of NSString that specifies filter queries. Please refer to webservice docu for further details query, categoryIds or filterQueries need to be set in request
ANWebserviceResponse

Represents an Webservice Response

Attribute Type Description
currentPage NSInteger Current Page
totalPages NSInteger Total pages
records NSInteger Record
totalRecords NSInteger Total Records
facets NSArray Array of ANWSFacet
shop ANWSShop Shop
items NSArray Array of ANWSItem items
ANWSItem

Protocol implemented by ANWSProduct, ANWSCategory and ANWSShop

ANWSProduct

Class that represents a Product

Attribute Type Description
productId NSInteger Product ID
articleNumber NSString Article Number
name NSString Product Name
description NSString Product description
descriptionShort NSString Product short description
score double Prodcut Score
lastProductChange NSDate Product Last Change Date
lastShopUpdate NSDate Last Shop Update
availability NSString Product Availability (currently not used by affilinet)
deliveryTime NSString Delivery Time (currently not used by affilinet)
deeplink1 NSString Deeplink 1
deeplink2 NSString Deeplink 2
brand NSString Brand
manufactor NSString Manufactor
distributor NSString Distributor
EAN NSString EAN
keywords NSString Keywords
shop ANWSShop Shop
properties NSArray Array of ANWSProductProperty
priceInformation ANWSPriceInformation Price Information
imageCollections NSArray Array of ANWSProductImageCollection
affilinetCategories NSArray Array of ANWSCategory
shopCategories NSArray Array of ANWSCategory
ANWSCategory

Class that represents a Category

Attribute Type Description
categoryId NSString Category ID
idPathItems NSArray Array of NSString that includes the id paths
title NSString Category title
titlePathItems NSArray Array of NSString that include the title paths
productCount NSInteger Product Count
ANWSShop

Class that represents a shop

Attribute Type Description
shopId NSInteger Shop ID
title NSString Shop Title
link NSString Shop Link
productCount NSInteger Product count
lastUpdate NSDate Shop last update
program ANWSProgram Shop Program
logos NSArray Array of ANWSShopLogo
ANWSProgram

Class that represents an advertiser program that a shop is connected to

Attribute Type Description
programId NSInteger Program ID
title NSString Program Title
ANWSShopLogo

Class that represents a shop logo.

Attribute Type Description
logoScale ANWSShopLogoScale Logo Scale
url NSString Logo URL
width NSInteger Logo Width
height NSInteger Logo Height
ANWSShopLogoScale

An enumeration that specifies the different logo scales

NoLogo
Logo50
Logo90
Logo120
Logo150
Logo468
ANWSProductProperty

Represents a product property

Attribute Type Description
name NSString Property name
value NSString Property value
ANWSPriceInformation

Represents the price information of a product

Attribute Type Description
basePrice ANWSPrice Base Price
price ANWSPrice Price
shippingPrice ANWSPrice Shipping Price
currency ANCurrency Currency in ISO format
ANWSPrice

Represents a price details

Attribute Type Description
oldPrice double Old Price
prefix NSString Prefix
price double Price
suffix NSString Suffix
displayPrice NSString displayPrice
ANWSProductImageCollection

Represents a collection of product Images

Attribute Type Description
images NSArray Array of ANWSProductImage
ANWSProductImage

Represents a product image

Attribute Type Description
productImageScale ANWSProductImageScale Image Scale
ANWSProductImageScale

An enumeration that represents different image scales

OriginalImage
Image30
Image60
Image90
Image120
Image180
NoImage
ANWSFacet

Represents a Facet

Attribute Type Description
field NSString The facet field
values NSArray Array of ANWSFacetValue
ANWSFacetValue

Represents a Facet Value

Attribute Type Description
name NSString The facet name
count NSInteger The facet count
ANWSShopIdMode

An enumeration that represents different shop id modes

Include
Exclude
ANWSProductSortBy

An enumeration that represents different sort by

Score
Price
Name
LastImported
ANWSSortOrder

An enumeration that represents different sort order

Ascending
Descending
ANWSFilterQuery

Represents a filter query

Attribute Type Description
dataField NSString The filter query data field
filterValue NSString The filter value

Use Case Ad View

Ad View

To show advertisements to the user, an ANAdView must be created with an advertisment object.

Import header files
#import AffilinetPublisher/AffilinetPublisher.h
Create Publisher Account
ANPublisherAccount  *account = [[ANPublisherAccount alloc] init];
account.accountID = {PUBLISHER-ID};
Open Session with Account and CountryCode
self.session = [ANSession sharedInstance];
[self.session openWithAccount:account andCountryCode:CountryCodeDE];
Create a container ad space

Get the id for the publisher container you want to embed from code provided in publisher login area

ANContainerAd *ad = [[ANContainerAd alloc] initWithSession:[ANSession sharedInstance]];
ad.pcid = @"container-ad-space-unique-id";
Set a size for the adspace

This could be a preset AdSize:

ad.size = ANFullSizeBanner;

Or a custom size:

ad.size = ANCustomAdSize;
ad.customSize = self.view.frame.size
Adopt the ANAdDisplayViewDelegate protocol
@interface YourClass () <ANAdDisplayViewDelegate>
@end
@implementation YourClass
...
-(void) adDisplayViewDidFinishLoading:(ANAdDisplayView *)adDisplayView {
    ...
}
-(void) adDisplayView:(ANAdDisplayView *)adDisplayView didFailLoading:(NSError *)error {
    ...
}
@end
Create the ad view

Adding the adView to your layout can differ from app to app. Have a look at our demo app for an example.

ANAdDisplayView *adView = [[ANAdDisplayView alloc] initWithFrame:(CGRect){{0,0}, self.view.frame.size} andAd:ad];
adView.delegate = self;

Use Case Webservice

Search Products

Searches for products based on a keyword query

Import header files
   #import AffilinetPublisher/AffilinetPublisher.h
Create Publisher Account
   ANPublisherAccount  *account = [[ANPublisherAccount alloc] init];
   account.accountID = {PUBLISHER-ID};
   // See: https://publisher.affili.net/Account/techSettingsPublisherWS.aspx
   account.webServicePassword = {PRODUCT-DATA-WEBSERVICE-PASSWORD}
Open Session with Account and CountryCode
   self.session = [ANSession sharedInstance];
   [self.session openWithAccount:account andCountryCode:CountryCodeDE];
Create a Search Products Request
   ANSearchProductsRequest *searchReq = [[ANSearchProductsRequest alloc] 
   initWithSession:[ANSession sharedInstance]];
   
   // use query keywords such as "iPhone" or "Samsung Galaxy"
   searchReq.query = @"KEYWORD";
   searchReq.shopIds = @[@"0"];
   searchReq.shopIdMode = Include;
   searchReq.useAffilinetCategories = NO;
   searchReq.excludeSubCategories = NO;
   searchReq.withImageOnly = YES;
   [searchReq addProductImageScale:OriginalImage];
   [searchReq addShopLogoScale:Logo120];
   searchReq.maximumPrice = 100.5;
   searchReq.minimumPrice = 0.5;
   searchReq.sortBy = Name;
   searchReq.sortOrder = Ascending;
Set session completion blocks
   session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");

           ANWebserviceRequest *wsRequest = (ANWebserviceRequest *)request;
           ANWebserviceResponse *wsResponse = (ANWebserviceResponse *)response;
           NSArray *products = wsResponse.items;
       }
   };

   session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
   };

   session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
   };
Execute request
   [session executeRequests:@[request]];

Get Products

To get an explicit list of products and their details

Import header files
   #import AffilinetPublisher/AffilinetPublisher.h
Create Publisher Account
   ANPublisherAccount  *account = [[ANPublisherAccount alloc] init];
   account.accountID = {PUBLISHER-ID};
   // See: https://publisher.affili.net/Account/techSettingsPublisherWS.aspx
   account.webServicePassword = {PRODUCT-DATA-WEBSERVICE-PASSWORD};
Open Session with Account and CountryCode
   self.session = [ANSession sharedInstance];
   [self.session openWithAccount:account andCountryCode:CountryCodeDE];
Create a Get Products Request
   ANGetProductsRequest *getProductsReq = [[ANGetProductsRequest alloc]
   initWithSession:[ANSession sharedInstance]];
   getProductsReq.productIds = @[@"PRODUCT-1-ID", @"PRODUCT-2-ID", @"PRODUCT-3-ID"];

   [getProductsReq addShopLogoScale:Logo120];
   [getProductsReq addShopLogoScale:Logo50];
   [getProductsReq addShopLogoScale:NoLogo];
        
   [getProductsReq addProductImageScale:OriginalImage];
   [getProductsReq addProductImageScale:Image30];
   [getProductsReq addProductImageScale:Image60];
   
Set session completion blocks
   session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");

           ANWebserviceRequest *wsRequest = (ANWebserviceRequest *)request;
           ANWebserviceResponse *wsResponse = (ANWebserviceResponse *)response;
           NSArray *products = wsResponse.items;
       }
   };

   session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
   };

   session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
   };
Execute request
   [session executeRequests:@[request]];

Get Shop List

To get a list of shops (= feeds of an advertiser)

Import header files
   #import AffilinetPublisher/AffilinetPublisher.h
Create Publisher Account
   ANPublisherAccount  *account = [[ANPublisherAccount alloc] init];
   account.accountID = {PUBLISHER-ID};
   // See: https://publisher.affili.net/Account/techSettingsPublisherWS.aspx
   account.webServicePassword = {PRODUCT-DATA-WEBSERVICE-PASSWORD};
Open Session with Account and CountryCode
   self.session = [ANSession sharedInstance];
   [self.session openWithAccount:account andCountryCode:CountryCodeDE];
Create a Get Shop List Request
   ANGetShopListRequest *getShopListReq = [[ANGetShopListRequest alloc] 
   initWithSession:[ANSession sharedInstance]];
   long timestamp =  1388601005;
   getShopListReq.updatedAfter = [NSDate dateWithTimeIntervalSinceReferenceDate:timestamp];
   getShopListReq.logoScale = NoLogo;
Set session completion blocks
   session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");

           ANWebserviceRequest *wsRequest = (ANWebserviceRequest *)request;
           ANWebserviceResponse *wsResponse = (ANWebserviceResponse *)response;
           NSArray *shops = wsResponse.items;
       }
   };

   session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
   };

   session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
   };
Execute request
   [session executeRequests:@[request]];

Get Category List

To get a list of a shop's category

Import header files
   #import AffilinetPublisher/AffilinetPublisher.h
Create Publisher Account
   ANPublisherAccount  *account = [[ANPublisherAccount alloc] init];
   account.accountID = {PUBLISHER-ID};
   // See: https://publisher.affili.net/Account/techSettingsPublisherWS.aspx
   account.webServicePassword = {PRODUCT-DATA-WEBSERVICE-PASSWORD};
Open Session with Account and CountryCode
   self.session = [ANSession sharedInstance];
   [self.session openWithAccount:account andCountryCode:CountryDE];
Create a Get Category List Request
   ANGetCategoryListRequest *request = [[ANGetCategoryListRequest alloc] 
   initWithSession:[ANSession sharedInstance]];
   request.shopId = @"SHOP-ID"; 
   // ID of the shop to retrieve the categories from (in order to get ShopIds please use GetShopList)
   
Set session completion blocks
   session.onRequestResponse = ^(ANRequest *request, ANRequestResponse *response) {
       if(response.error != nil) {
           NSLog(@"Request Finished with Error: %@", response.error.localizedDescription);
       }
       else {
           NSLog(@"Request Finished");

           ANWebserviceRequest *wsRequest = (ANWebserviceRequest *)request;
           ANWebserviceResponse *wsResponse = (ANWebserviceResponse *)response;
           NSArray *categories = wsResponse.items;
       }
   };

   session.onRequestsError = ^(NSError *error) {
       NSLog(@"Requests error: %@", [error domain]);
   };

   session.onRequestsFinished = ^{
       NSLog(@"Requests finished");
   };
Execute request
   [session executeRequests:@[request]];

Android Publisher SDK

Requirements

  • Android 2.3.3 (Gingerbread) or later
  • A valid affilinet publisher account
  • Jsoup library (v. 1.7.2+)
  • Android Async HTTP library (v. 1.4.4+)
  • INTERNET permission must be set in AndroidManifest.xml file of the app

How to use

On Android Studio:
  1. Copy the affilinetsdk.aar library file into the libs folder
  2. Add the following line to the gradle.build
    1
    2
    3
    4
    5
    6
    7
    8
    9
            repositories {
                jcenter()
                flatDir {
                    dirs 'libs'
                }
            }
            dependencies {
                compile 'com.rm.affilinet:affilinetsdk@aar'
            }
    

Class Overview

General Classes

Session

The publisher must always open a session before doing any type of requests with affilinet backend. The Session object should be used as a singleton throught the whole application and is responsible to do all the requests to affilinet.

Attribute Type Description Mandatory
account Account The session’s account YES
platform Platform The session’s platform. Not mandatory, if used via webservices YES
Method Returns Description
getInstance() Session Returns an instance of a Session
open(Context, Account, Platform) void Opens a session with the specified account and Platform
executeHtmlRequests(List, SessionCallback) void Executes the requests in the input List
PublisherAccount

The PublisherAccount class specifies the account to be used by the SDK on all requests to affilinet.

Attribute Type Description Mandatory
accountID int The publisher's account id YES
webServicePassword String The publisher's product data webservice account password (only required if webservice requests will be made) NO
Constructor Returns Description
PublisherAccount(int accountId) PublisherAccount Class Constructor
PublisherAccount(accountId, String webServicePassword) PublisherAccount Class Constructor if webservice requests will be made
Country

The Country specifies a country (with a platform) that can be later used to open a session with affilinet.

Method Returns Description
Country(Platform platform) Country The contructor method of the class
getCountryCode string Gets the country code as a string value
getDomain string Gets the country affilinet domain
Platform

The Platform is a enumeration that makes it easier to specify a Country Code.

DE
AT
CH
GB
FR
ES
NL
BE
LU
Request

All requests to affilinet (either by javascript or webservice calls) are specified by Request objects. The Request class is an abstract class and cannot be instantiated directly.

Attribute Type Description Mandatory
session Session The session YES
protocol Protocol The request web protocol YES
Method Returns Description
Request(Session) Request Creates a new instance of a request
Protocol

The Protocol is a enumeration that makes it easier to specify a protocol.

HTTP
HTTPS

Ad Views

Ad

The Ad class is an abstract class that represents an Advertisement

Attribute Type Description Mandatory
session Session The session YES
size AdSize The Ad Size YES
ContainerAd

The ContainerAd represents a container ad.

Attribute Type Description Mandatory
pcid String Unique publisher container identifier. Copy from container code provided in publisher login area. YES
subid String Used to submit additional information NO
Method Returns Description
ContainerAd(Session session, String pcid, String subid) ContainerAd Initializes a new instance of a container ad
setAdSize(AdSize adSize) void setter
AdSize

The AdSize is a class that represents specific ad sizes. If none of the predefined sizes suits one's needs, there is a possibility to set a custom size: new AdSize(new Size(300,300))

Type Size
FullSizeBanner 468 x 60
MediumRectangle 300 x 250
WideSkyscrapper 160 x 600
Skyscrapper 120 x 600
Leaderboard 728 x 90
SquareBanner 250 x 250
FeaturePhoneMediumBanner 168 x 28
FeaturePhoneLargeBanner 216 x 36
SmartphoneBanner 300 x 50
SmartphoneWideBanner 320 x 50
SmartphoneWideBanner 320 x 50
AdDisplayView

The AdDisplayView extends an WebView and is a container to show advertisements. When the user presses on the ad, the user is redirected to the ad target link in the default operating system browser.

Attribute Type Description Mandatory
delegate AdDisplayViewCallback Callback YES
refreshInterval long Refresh ad interval in miliseconds (should not be lower than 10000, default is 30000 which equals 30sec.) YES

Product Data Webservice Requests

For detailed information about webservice, please also consult the Product Data Webservice GET Documentation

GetShopListRequest

The GetShopListRequest extends an Request and is used to retrieve a list of shops. Shops represent the different product feeds of an advertiser.

Attribute Type Description Mandatory
currentPage int Current page to retrieve NO
pageSize int Number of shops per page NO
query String A query to filter results NO
updatedAfter Date Returns only shops updated after the specified date NO
logoScale WSShopLogoScale The desired logo size NO
Method Returns Description
setLogoScale(WSShopLogoScale logoScale) void setter method
setQuery(String query) void setter method
setUpdatedAfter(Date updatedAfter) void setter method
setCurrentPage(int currentPage) void setter method
setPageSize(int pageSize) void setter method
GetCaregoryListRequest

The GetCategoryListRequest extends an Request and is used to retrieve a list of a shop categories.

Attribute Type Description Mandatory
shopId int Shop ID to retrieve the categories from YES
currentPage int Current page to retrieve NO
pageSize int Number of categories per page NO
Method Returns Description
setShopId(int shopId) void setter method
setCurrentPage(int currentPage) void setter method
setPageSize(int pageSize) void setter method
GetProductsRequest

The GetProductsRequest extends an Request and is used to retrieve the details of the specified product IDs.

Attribute Type Description Mandatory
productIds List An array with the product IDs to retrieve YES
currentPage int Current page to retrieve NO
pageSize int Number of shops per page NO
logoScales List<WSShopLogoScale> An array with the desired shop logo sizes NO
imageScales List <WSProductImageScale> An with the desired product image sizes NO
Method Returns Description
setLogoScales(List<WSShopLogoScale> logoScales) void setter method
setImageScales(List<WSProductImageScale> imageScales) void setter method
setProductIds(List<String> productIds) void setter method
setCurrentPage(int currentPage) void setter method
setPageSize(int pageSize) void setter method
SearchProductsRequest

The SearchProductsRequest extends an Request and is used to retrieve the details of the products, resulting from the query.

Attribute Type Description Mandatory
currentPage int Current page to retrieve NO
pageSize int Number of shops per page NO
logoScales List<WSShopLogoScale> An array with the desired shop logo sizes NO
imageScales List<WSProductImageScale> An array with the desired product image sizes NO
query String The keyword(s) you want the products to match. Can be any length. The following search operators are supported:
  • AND (both query tokens must be contained in the product, but not necessarily next to one another)
  • OR (any of the query tokens must be contained in the product)
  • NOT (e.g. with "ipod AND NOT nano", you will get products, which match the query "ipod", but at the same time don’t match "nano")
  • " (phrase match: all query tokens enclosed with quotes must be contained in the found products in that order)
  • () (Parentheses, to group expressions)

The wildcard * is supported for suffix matching, that is: a query bott* will match products that contain the word "bottle" or the word "bottom".

Search operators AND, OR and NOT must be in capital letters.

Example: "apple ipod" ((touch OR classic) NOT nano) AND "32 GB"

query, categoryIds or filterQueries need to be set in request
shopIds List An array that specifies the shop IDs on where to search the products NO
categoryIds List An array that specifies the category IDs on where to search the products query, categoryIds or filterQueries need to be set in request
useAffilinetCategories boolean Specifies wether to include or exclude the affilinet categories from the search NO
excludeSubCategories boolean Specifies wether to include or exclude sub categories form the search NO
withImageOnly boolean Specifies wether to return only products with images or without. NO
minimumPrice double Minimum price of the products NO
maximumPrice double Maximum price of the products NO
facetFields List An array that specifies a set of facet fields NO
facetValueLimit int Specifies the limit of the facet values NO
shopIdMode WSShopIdMode Shop Id Mode NO
sortBy WSProductSortBy Sort By NO
sortOrder WSSortOrder Sort order NO
filterQueries List An array that specifies filter queries. Please refer to webservice docu for further details query, categoryIds or filterQueries need to be set in request
Method Returns Description
setSortOrder(WSSortOrder sortOrder) void setter method
setSortBy(WSProductSortBy sortBy) void setter method
setMaximumPrice(double maximumPrice) void setter method
setMinimumPrice(double minimumPrice) void setter method
setWithImageOnly(boolean withImageOnly) void setter method
setLogoScales(List<WSShopLogoScale> logoScales) void setter method
setCategoryIds(List<String> categoryIds) void setter method
setImageScales(List<WSProductImageScale> imageScales) void setter method
setUseAffilinetCategories(boolean useAffilinetCategories) void setter method
setExcludeSubCategories(boolean excludeSubCategories) void setter method
setCategoryIds(List<String> categoryIds) void setter method
setFacetFields(List<String> facetFields) void setter method
setFacetValueLimit(int facetValueLimit) void setter method
setFilterQueries(List<WSFilterQuery> filterQueries) void setter method
setShopIdMode(WSShopIdMode shopIdMode) void setter method
setShopIds(List<Integer> shopIds) void setter method
setCurrentPage(int currentPage) void setter method
setPageSize(int pageSize) void setter method
WebserviceResponse

Represents an Webservice Response

Attribute Type Description
currentPage int Current Page
totalPages int Total pages
records int Record
totalRecords int Total Records
facets List< WSFacet> Array of facets
shop WSShop Shop
items List<WSItem> Array of items
WSItem

Abstract class extended by WSProduct, WSCategory and WSShop

WSProduct

Class that represents a Product

Attribute Type Description
productId int Product ID
articleNumber String Article Number
name String Product Name
description String Product description
descriptionShort String Product short description
score double Prodcut Score
lastProductChange Date Product Last Change Date
lastShopUpdate Date Last Shop Update
availability String Product Availability (currently not used by affilinet)
deliveryTime String Delivery Time (currently not used by affilinet)
deeplink1 String Deeplink 1
deeplink2 String Deeplink 2
brand String Brand
manufactor String Manufactor
distributor String Distributor
EAN String EAN
keywords String Keywords
shop WSShop Shop
properties List< WSProductProperty> Array of properties
priceInformation WSPriceInformation Price Information
imageCollections List< WSProductImageCollection> Array of image collections
affilinetCategories List<WSCategory> Array of affilinet categories
shopCategories List<WSCategory> Array of of shop categories
WSCategory

Class that represents a Category

Attribute Type Description
categoryId String Category ID
idPathItems List Array of id paths
title String Category title
titlePathItems List Array of title paths
productCount int Product Count
WSShop

Class that represents a shop

Attribute Type Description
shopId int Shop ID
title String Shop Title
link String Shop Link
productCount int Product count
lastUpdate Date Shop last update
program WSProgram Shop Program
logos List<WSShopLogo> Array of logos
WSProgram

Class that represents an advertiser program that a shop is connected to

Attribute Type Description
programId int Program ID
title String Program Title
WSShopLogo

Class that represents a shop logo.

Attribute Type Description
logoScale WSShopLogoScale Logo Scale
url String Logo URL
width int Logo Width
height int Logo Height
WSShopLogoScale

An enumeration that specifies the different logo scales

NoLogo
Logo50
Logo90
Logo120
Logo150
Logo468
WSProductProperty

Represents a product property

Attribute Type Description
name String Property name
value String Property value
WSPriceInformation

Represents the price information of a product

Attribute Type Description
basePrice WSPrice Base Price
price WSPrice Price
shippingPrice WSPrice Shipping Price
currency CurrencyCode Currency in ISO format
WSPrice

Represents a price details

Attribute Type Description
oldPrice double Old Price
prefix String Prefix
price double Price
suffix String Suffix
displayPrice String displayPrice
WSProductImageCollection

Represents a collection of product Images

Attribute Type Description
images List<WSProductImage> Array of product images
WSProductImage

Represents a product image

Attribute Type Description
productImageScale WSProductImageScale Image Scale
WSProductImageScale

An enumeration that represents different image scales

OriginalImage
Image30
Image60
Image90
Image120
Image180
NoImage
WSFacet

Represents a Facet

Attribute Type Description
field String The facet field
values List<WSFacetValue> Array of facet values
WSFacetValue

Represents a Facet Value

Attribute Type Description
name String The facet name
count int The facet count
WSShopIdMode

An enumeration that represents different shop id modes

Include
Exclude
WSProductSortBy

An enumeration that represents different sort by

Score
Price
Name
LastImported
WSSortOrder

An enumeration that represents different sort order

Ascending
Descending
WSFilterQuery

Represents a filter query

Attribute Type Description
dataField String The filter query data field
filterValue String The filter value

Use Case Ad View

Ad View

To show advertisements to the user, an AdView must be created with an advertisment object.

Import header files
import com.rm.affilinet.*;
Create Publisher Account
PublisherAccount account = new PublisherAccount({PUBLISHER-ID});
Open Session with Account and CountryCode
Session session = Session.getInstance();
try {
    session.open(getApplicationContext(), account, Platform.DE);
} catch (Exception e) {
    Log.v("affilinet", e.getMessage());
}
Create a container ad space

Get the id for the publisher container you want to embed from code provided in publisher login area:

ContainerAd containerAd = new ContainerAd(session, "container-ad-space-unique-id", "pub-subid");
Set a size for the adspace

This could be a preset AdSize:

containerAd.setAdSize(AdSize.FeaturePhoneLargeBanner);
Or a custom size:
containerAd.setAdSize(new AdSize(new Size(300,300)));
Create the ad view

Adding the adView to your layout can differ from app to app. Have a look at our demo app for an example.

setContentView(R.layout.activity_main);
AdDisplayView adView = new AdDisplayView(getApplicationContext(), containerAd, 30000);
RelativeLayout mainLayout = (RelativeLayout) findViewById(R.id.relative_layout);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
mainLayout.addView(adView, params);

Use Case Webservice

Search Products

Searches for products based on a keyword query

Import header files
import com.rm.affilinet.*;
Create Publisher Account
PublisherAccount account = new PublisherAccount({PUBLISHER-ID}, {PRODUCT-DATA-WEBSERVICE-PASSWORD});
Open Session with Account and Platform
Session session = Session.getInstance();
try {
session.open(getApplicationContext(), account, null);
} catch (Exception e) {
}
Create a Search Products Request
SearchProductsRequest req = new SearchProductsRequest(session);

List<Integer> shopIds = new ArrayList<Integer>();
shopIds.add(0);
List<WSProductImageScale> imagescales = new ArrayList<>();
imagescales.add(WSProductImageScale.Image90);
imagescales.add(WSProductImageScale.Image180);
List<WSShopLogoScale> logoscales = new ArrayList<>();
logoscales.add(WSShopLogoScale.Logo120);

// use query keywords such as "iPhone" or "Samsung Galaxy"
req.setQuery("KEYWORD");
req.setShopIds(shopIds);
req.setShopIdMode(Include);
req.setUseAffilinetCategories(false);
req.setExcludeSubCategories(false);
req.setWithImageOnly(true);
req.setImageScales(imagescales);
req.setLogoScales(logoscales);
req.setMaximumPrice(999.00);
req.setMinimumPrice(50.00);
req.setSortBy(WSProductSortBy.valueOf("Name"));
req.setSortOrder(WSSortOrder.Ascending);
Execute request
List<Request> requests = new ArrayList<Request>();
requests.add(req);
try {
    Session.getInstance().executeRequests(requests, new SessionCallback() {

       @Override
         public void onRequestsFinished() {
            Log.v("affilinet", "Requests finished");
       }

       @Override
       public void onRequestsError(Error error) {
            Log.v("affilinet", "Requests finished with error: " + error);
       }

       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
              if(response.error != null) {
                Log.v("affilinet", String.format("Request %s finished with error %s", request.toString(), response.error.getMessage()));
           }
            else {
                Log.v("affilinet", String.format("Request %s finished with response %s", request.toString(), response.toString()));

               WebserviceRequest wsRequest = (WebserviceRequest) request;
               WebserviceResponse wsResponse = (WebserviceResponse) response;
               List<WSCategory> products = wsResponse.items;
           }
       }
   });
   } catch (SessionException e) {
         Log.v("affilinet", e.getMessage());
   }

Get Products

To get an explicit list of products and their details

Import header files
import com.rm.affilinet.*;
Create Publisher Account
PublisherAccount account = new PublisherAccount({PUBLISHER-ID}, {PRODUCT-DATA-WEBSERVICE-PASSWORD});
Open Session with Account and Platform
Session session = Session.getInstance();

try {
session.open(getApplicationContext(), account, null);
} catch (Exception e) {
}
Create a Get Products Request
GetProductsRequest req = new GetProductsRequest(session);

List<WSProductImageScale> imagescales = new ArrayList<WSProductImageScale>();
imagescales.add(WSProductImageScale.OriginalImage);
imagescales.add(WSProductImageScale.Image60);
    
List<WSShopLogoScale> logoscales = new ArrayList<WSShopLogoScale>();
logoscales.add(WSShopLogoScale.Logo120);
        
List<String> productIDs = new ArrayList<String>();
productIDs.add("493822602");
productIDs.add("526068620");
productIDs.add("437092183");
            
req.setProductIds(productIDs);
req.setImageScales(imagescales);
req.setLogoScales(logoscales);
Execute request
List<Request> requests = new ArrayList<Request>();
requests.add(req);
try {
    Session.getInstance().executeRequests(requests, new SessionCallback() {

       @Override
         public void onRequestsFinished() {
            Log.v("affilinet", "Requests finished");
       }

       @Override
       public void onRequestsError(Error error) {
            Log.v("affilinet", "Requests finished with error: " + error);
       }

       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
              if(response.error != null) {
                Log.v("affilinet", String.format("Request %s finished with error %s", request.toString(), response.error.getMessage()));
           }
            else {
                Log.v("affilinet", String.format("Request %s finished with response %s", request.toString(), response.toString()));

               WebserviceRequest wsRequest = (WebserviceRequest) request;
               WebserviceResponse wsResponse = (WebserviceResponse) response;
               List<WSCategory> products = wsResponse.items;
           }
       }
   });
   } catch (SessionException e) {
         Log.v("affilinet", e.getMessage());
   }

Get Shop List

To get a list of a shops

Import header files
import com.rm.affilinet.*;
Create Publisher Account
PublisherAccount account = new PublisherAccount({PUBLISHER-ID}, {PRODUCT-DATA-WEBSERVICE-PASSWORD});
Open Session with Account and Platform
Session session = Session.getInstance();

try {
    session.open(getApplicationContext(), account, null);
} catch (Exception e) {
}
Create a Get Shop List Request
GetShopListRequest req = new GetShopListRequest(session);
long timestamp =  1388601005;
timestamp *= 1000;
req.setUpdatedAfter(new Date(timestamp));
req.setLogoScale(WSShopLogoScale.NoLogo);
Execute request
List<Request> requests = new ArrayList<Request>();
requests.add(req);
try {
    Session.getInstance().executeRequests(requests, new SessionCallback() {

       @Override
         public void onRequestsFinished() {
            Log.v("affilinet", "Requests finished");
       }

       @Override
       public void onRequestsError(Error error) {
            Log.v("affilinet", "Requests finished with error: " + error);
       }

       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
              if(response.error != null) {
                Log.v("affilinet", String.format("Request %s finished with error %s", request.toString(), response.error.getMessage()));
           }
            else {
                Log.v("affilinet", String.format("Request %s finished with response %s", request.toString(), response.toString()));

               WebserviceRequest wsRequest = (WebserviceRequest) request;
               WebserviceResponse wsResponse = (WebserviceResponse) response;
               List<WSShop> shops = wsResponse.items;
           }
       }
   });
} catch (SessionException e) {
     Log.v("affilinet", e.getMessage());
}

Get Category List

To get a list of a shop's categories

Import header files
import com.rm.affilinet.*;
Create Publisher Account
PublisherAccount account = new PublisherAccount({PUBLISHER-ID}, {PRODUCT-DATA-WEBSERVICE-PASSWORD});
Open Session with Account and Platform
Session session = Session.getInstance();
try {
    session.open(getApplicationContext(), account, null);
} catch (Exception e) {
}
Create a Get Category List Request
GetCategoryListRequest req = new GetCategoryListRequest(session);
req.setShopId(102);
// ID of the shop to retrieve the categories from (in order to get ShopIds please use GetShopList)
Execute request
List<Request> requests = new ArrayList<Request>();
requests.add(req);
try {
    Session.getInstance().executeRequests(requests, new SessionCallback() {

       @Override
         public void onRequestsFinished() {
            Log.v("affilinet", "Requests finished");
       }

       @Override
       public void onRequestsError(Error error) {
            Log.v("affilinet", "Requests finished with error: " + error);
       }

       @Override
       public void onRequestResponse(Request request, RequestResponse response) {
              if(response.error != null) {
                Log.v("affilinet", String.format("Request %s finished with error %s", request.toString(), response.error.getMessage()));
           }
            else {
                Log.v("affilinet", String.format("Request %s finished with response %s", request.toString(), response.toString()));

               WebserviceRequest wsRequest = (WebserviceRequest) request;
               WebserviceResponse wsResponse = (WebserviceResponse) response;
               List<WSCategory> products = wsResponse.items;
           }
       }
   });
   } catch (SessionException e) {
         Log.v("affilinet", e.getMessage());
   }