Sourcengo REST API Guidelines for Publishers

As a publisher, you usually may want to use the sourcengo REST API if you have advanced customization and integration needs, or if you are concerned with the part of your audience that is using ad blocking extensions while browsing your site.

Furthermore, publishers do not have to save the returned content to their database. It is always available upon request, and served through the powerfull Amazon Cloudfront distribution service.

Offers can be customized as you want on your server side and displayed on your site without being ad blocked.  An offer is the set of complete metadata for an ad returned in JSON format.

In general, you may filter the returned offers using different parameters such as:

  • Keywords
  • Number
  • Cost Type
  • Creative Type

The API serves two kinds of offers through two specific methods. A third method is also available to check the ad campaign status (availability).

getoffers method

Ideal method if you want to display rich native ads. This method serves ads with a complete set of metadata such as:

  • Featured image
  • Square icon image (in case of apps or software ads)
  • Title
  • Body text
  • Click URL
  • Call to Action Text (generally used on a button)
  • The current Rating
  • The advertisers target countries for that ad.
  • Type (Recommended Software, Deals, Sponsored Articles, Whitepaper…)
  • Cost Type (CPC, CPA, CPL etc.)
  • Status (whether the ad campaign is active or not)
  • Exist (whether the ad is still available or not)

getbanneroffers method

Ideal for Banner display ads. One offer may contain multiple banner formats. You must make one API call for each desired format. The returned metadata for one offer are:

  • Banner Image Link
  • Offer Title (not meant to be displayed)
  • Body text (not meant to be displayed)
  • Click URL
  • Type (Recommended Software, Deals, Sponsored Articles, Whitepaper…)
  • The advertisers target countries
  • Cost Type (CPC, CPA, CPL etc.)
  • Status (whether the ad campaign is active or not)
  • Exist (whether the ad is still available or not)

Get Offers (getoffers method)

GET Request

Example:

https://api.sourcengo.com/requestsservice/getbanneroffers/? accesskey= YWRKcmRJWEesejhkYXJIRDdXVWI3Zz09&aff_id=85&keywords=crm,accounting&number=50&format=leaderboard
Parameter Default value Optional Description & Example
accesskey Your private Access Key No You can find your Private Access Key in your sourcengo admin panel (located at app.sourcengo.com), under the “Account Info/REST API” tab.

Ex: YWRKcmRJWEesejhkYXJIRDdXVWI3Zz09

aff_id Your unique affiliate id number No Your Affiliate id Number. It is also available in your sourcengo admin panel under the “Account Info/REST API” tab.

Ex: 85

keywords None – No tag filtering Yes
(default is applied)
A coma separated list of words that characterizes the requested offers.

We automatically return the offers that best match your list of tags. This tag filtering is optional.

Ex: antivirus,crm

number 1 (max = 100) Yes
(default is applied)
The number of offers to be returned in the JSON. The default value is “1” and the maximum value is “100”.

For larger amounts, do not hesitate to get in touch with us.

cost_types all Yes
(default is applied)
A comma separated list of the desired payout cost models.

Ex : “cpc,cpa,cpl”

creative_types recommended,deal Yes
(default is applied)
List comma separated  of types:  recommended,  deal, whitepaper, webinar, ebook, content (empty is default equal to “recommended,deal”)

Here is a sample result of an item returned in JSON format.

{
offerid“: 1330,
affiliateid“: 25,
title“: “Shaw Academy”,
body“: “Get Up to 95% Off on an Accredited Diploma from Shaw Academy!”,
featured_image_link“:”https://d1gpxn1nf5xsl8.cloudfront.net/images/sitesscreens/med/shaw-academy_4280.jpg”,
squareicon_image_link“:”https://d1gpxn1nf5xsl8.cloudfront.net/images/small/11447434073858.png”,
click_url“:”https://cwtrackit.com/aff_c/?integtool=JS&pref=0&aff_id=50&offer_id=734”,
cta“:”Free Trial”,
creative_type“:”recommended”,
keywords“:”software,business”,
star_rating“: 3.8,
active“: 1,
cost_type“: cpa,
authorized_countries” : “US,ES,FR,NZ,GR”
}

Php Exemple

See the code below in action at this URL : https://api.sourcengo.com/testapi.php

< ?php
/*API REST query syntax*/
$query="https://api.sourcengo.com/requestsservice/getoffers/?accesskey=YWRKcmRJWEesejhkYXJIRDdXVWI3Zz09&aff_id=85&keywords=antivirus,crm&number=10&cost_types=CPC,CPL&creative_types=recommended,webinar";

/* Sending the request using file_get_contents. Also available with CURL.*/
$response = file_get_contents($query) ;
$offers=json_decode($response);

/*Reading and using the Response*/
if(!empty($offers)){
foreach($json as $ad ){
$offerid= $ad->offerid;
$affiliateid=$ad->affiliateid;
$title=$ad->title;
$featured_image_link=$ad->featured_image_link;
$squareicon_image_link=$ad->squareicon_image_link;
$click_url=$ad->click_url;
$cta=$ad->cta;
$keywords=$ad->keywords;
$star_rating=$ad->star_rating;
$active=$ad->active;
$cost_type=$ad->cost_type;
$creative_type=$ad->creative_type;
echo '<img src="'.$squareicon_image_link.'" />'.$ad->title."<br>";
echo $ad->creative_type."<br>"; 
echo $ad->featured_image_link."<br>"; 
}
}
?>
Make sure that the url has a valid URI syntax.

  • file_get_contents:
$response = file_get_contents($query) ;
$offers=json_decode($response;

OR

  • CURL:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $query);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
$response = curl_exec($ch);
$offers =json_decode($response);

getbanneroffers method

Banners come in various formats. They are compliant with the standard iab formats listed below.

Banner format Format (in pixels)
mediumrectangle 300×250
largerectangle 336×280
leaderboard 728×90
halfpage 300×600
largemobilebanner 320×100

Other iab standard formats will be available soon. Get in touch with us for more information.

GET Request

Example:

https://api.sourcengo.com/requestsservice/getbanneroffers/? accesskey= YWRKcmRJWEesejhkYXJIRDdXVWI3Zz09&aff_id=85&keywords=crm,accounting&number=50&format=leaderboard
Parameter Default value Optional Description & Example
accesskey Your private Access Key No You can find your Private Access Key in your sourcengo admin panel (located at app.sourcengo.com), under the “Account Info/REST API” tab.

Ex: YWRKcmRJWEesejhkYXJIRDdXVWI3Zz09

aff_id Your unique affiliate id number No Your Affiliate id Number. It is also available in your sourcengo admin panel under the “Account Info/REST API” tab.

Ex: 85

keywords None – No tag filtering Yes

(default is applied)

A coma separated list of words that characterizes the requested offers.We automatically return the offers that best match your list of tags. This tag filtering is optional.

Ex: antivirus,crm

number 1 (max = 100) Yes

(default is applied)

The number of offers to be returned in the JSON. The default value is “1” and the maximum value is “100”.For larger amounts, do not hesitate to get in touch with us.
format leaderboard Yes

(default is applied)

The number of offers to be returned in the JSON. The default value is “1” and the maximum value is “100”.

For larger amounts, do not hesitate to get in touch with us.

CONTACT US

We would like to hear from you. Send your message and we will get back to you soon.

Sending

©2017 Sourcengo. All Rights Reserved

Log in with your credentials

Forgot your details?