TUNE accounts that are partners for other TUNE accounts can use our affiliate and network APIs to programmatically import new offers into their network.
There are two parts to this process:
- First, retrieve the offers' data from your partner account using the Partner API. You can only use this process if you have an API key for your advertiser's network.
- Second, import the offers' data into your network account using the Network API. The network API is available to Enterprise-level clients and higher.
- This document briefly outlines the relevant API calls and key parameters to use. It requires users to modify the network and affiliate API calls to retrieve what's necessary, as well as write the software solution to turn the data retrieved from your advertisers into calls to your network API. For further details on each call, follow the links to their developer documentation.
Retrieving & Importing Core Offer Data
The affiliate API endpoint for retrieving core offer data is Affiliate_Offer::findall.
https://NETWORKID.api.hasoffers.com/Apiv3/json?api_key=APIKEY&Target=Affiliate_Offer&Method=findAll
This returns a JSON array of Offer model objects.
To retrieve the offer category, geo-targeting information, and the offer thumbnails, append &contain[]=OfferCategory&contain[]=Country&contain[]=Thumbnail
to the call.
Payout Details & Tracking Links
Two other calls are needed to retrieve payout details and tracking links: Affiliate_Offer::getPayoutDetails and Affiliate_Offer::generateTrackingLink. You must run these calls for each individual offer.
Affiliate_Offer.getPayoutDetails:
https://NETWORKID.api.hasoffers.com/Apiv3/json?api_key=APIKEY&Target=Affiliate_Offer&Method=getPayoutDetails&offer_id=OFFERID
Affiliate_Offer.generateTrackingLink:
https://NETWORKID.api.hasoffers.com/Apiv3/json?api_key=APIKEY&Target=Affiliate_Offer&Method=generateTrackingLink&offer_id=OFFERID
Finding the Default Currency
If you need to check your advertiser's default currency, use the Affiliate_AffiliateUser::getContext call to return a collection of arrays containing preferences. Your advertiser's default currency is the value of network_currency in the BrandPreferences array.
Importing into Your Network
The network API endpoint for creating offers is Offer::create. For each offer, you retrieved and wish to import, run this call with that data.
Note: The required fields for Offer.create data parameter are: name, offer_url, preview_url, protocol, and expiration_date. We recommend setting the payout and revenue fields as well.
That’s all you need for importing basic offers from your advertiser into your network. The following section covers advanced offer settings.
Importing Offers that Require Approval
Some advertisers have offer approval processes in place. Those offers have their require_approval parameter set to "1", which you can find from Affiliate_Offer.findAll. If this feature is enabled, the advertiser may require you to answer questions when you request access to the offer. You can check for these questions with Affiliate_Offer::getApprovalQuestions. To request access to the offer using the API, use Affiliate_Offer::requestOfferAccess.
Retrieving & Importing Additional Offer Settings
Use the following methods to retrieve and import deeper offer settings.
Goals
Advertisers have Offer goals enabled on a given offer if that offer's has_goals_enabled parameter is "1", which you can find from Affiliate_Offer.findAll. Use Affiliate_Goal::findAll to retrieve offer goal information for those offers.
When creating an offer in your network that uses advanced targeting rules, set has_goals_enabled to "1" and default_goal_name to the order's default goal name in your Offer.create call. Then use Goal::create to add goals to an offer once the offer is created in your network
Creative Files & Thumbnails
Use Affiliate_OfferFile::findAll to retrieve Creative files and thumbnails from your advertiser.
When adding creative files to your network's offers, use OfferFile::create.
Categories
Some advertisers Categorize their offers for partners. To retrieve these categories as part of your Affiliate_Offer.findall call, append &contain[]=OfferCategory
to your call.
Once an offer is created in your network, use Offer::setCategories to apply the categories you wish—whether you mirror your advertisers or have your own structure. You must know the matching category IDs in your network to automate the process.
If the category doesn't exist, Create it within the application or use Application::addOfferCategory.
Targeting Settings
Geo-Targeting
To retrieve the Geo-targeting rules on your advertiser's offers, append &contain[]=Country
to your Affiliate_Offer.findall call.
When creating an offer in your network that uses geo-targeting rules, set enforce_get_targeting to "1" in your Offer.create call. Then use Offer::setTargetCountries to add geo-targeting rules to an offer once the offer is created in your network. If you need to set target regions within countries, use Offer::addTargetCountryRegion.
Advanced Targeting
Retrieving and setting Advanced targeting rules works similarly to geo-targeting rules. To retrieve advanced targeting rules on an advertiser's offer, use Affiliate_OfferTargeting.getRuleTargetingForOffer.
When creating an offer in your network that uses advanced targeting rules, set use_target_rules to "1" in your Offer.create call. Then use OfferTargeting::addTargetRuleToOffer to add advanced targeting rules to an offer once the offer is created in your network. See the documentation on OfferTargeting::findTargetRules for more information.
Offers must be in an offer group for advanced targeting to function. Use Offer::setGroups to put offers into your offer groups.