SlideShare a Scribd company logo
1 of 19
Download to read offline
Best Ways to
Use the API
ShareASale Think Tank 2013
Eric Nagel
eric@ericnagel.com
What is the ShareASale API?
● API = Application Programming Interface
○ An application programming interface (API) specifies
how some software components should interact with
each other.
○ It’s a way for your website to talk directly to the
ShareASale system

● Affiliate API
● Merchant API
Where to find the ShareASale API
Affiliate API Under
Tools

Merchant API
Under Tools
Affiliate API: Authentication
The Authentication Hash
Authentication Hash : SHA-256 Hash in 64 character Hex format of the string "YourAPIToken:CurrentDateInUTCFormat:
APIActionValue:YourAPISecret" (without quotes)

For example, for following values:
Token: NGc6dg5e9URups5o
API Secret: ATj7vd8b7CCjeq9yQUo8cc2w3OThqe2e
String to Hash: NGc6dg5e9URups5o:Thu, 14 Apr 2011 22:44:22 GMT:bannerList:ATj7vd8b7CCjeq9yQUo8cc2w3OThqe2e
UTC Date: Thu, 14 Apr 2011 22:44:22 GMT
API Action: bannerList

The correct HTTP Headers would be:
x-ShareASale-Date: Thu, 14 Apr 2011 22:44:22 GMT
x-ShareASale-Authentication: 78D54A3051AE0AAAF022AA2DA230B97D5219D82183FEFF71E2D53DEC6057D9F1
Affiliate API: Authentication
IP Restrictions

Start > Run
cmd
ping domain.com
Gives you the IP

These are the IPs that will be accessing the
data. Since the script will reside on your
server, use your server’s IP.
Affiliate API: Authentication

HUH????
Don’t worry.
1. Click “View Sample code in PHP”
2. Copy
3. Paste
4. Change values
Affiliate API: Sample
<?php

$myAffiliateID = '';

Get these values from the API page

$APIToken = "";
$APISecretKey = "";
$myTimeStamp = gmdate(DATE_RFC1123);

$APIVersion = 1.8;

We’ll get
to this

$actionVerb = "activity";
$sig = $APIToken.':'.$myTimeStamp.':'.$actionVerb.':'.$APISecretKey;

$sigHash = hash("sha256",$sig);

$myHeaders = array("x-ShareASale-Date: $myTimeStamp","x-ShareASale-Authentication: $sigHash");
Affiliate API: Sample
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "https://shareasale.com/x.cfm?
affiliateId=$myAffiliateID&token=$APIToken&version=$APIVersion&action=$actionVerb");
curl_setopt($ch, CURLOPT_HTTPHEADER,$myHeaders);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);

$returnResult = curl_exec($ch);

Nothing to
do here.
Affiliate API: Sample
if ($returnResult) {
//parse HTTP Body to determine result of request
if (stripos($returnResult,"Error Code ")) {
// error occurred
trigger_error($returnResult,E_USER_ERROR);
}
else{
// success
echo $returnResult;
}

This is where you take over and
put in your custom coding to do
whatever you want with the data.

}
else{
// connection error
trigger_error(curl_error($ch),E_USER_ERROR);
}
Affiliate API
●
●
●
●
●
●
●
●
●
●

Activity Details
Activity Summary
Merchant Timespan Report
Today's Stats
Monthly Summary
Void Trail
Traffic
API Token Count
Get Products
Invalid Links

●
●
●
●
●
●
●
●
●
●

Datafeed Merchants
Coupon/Deal Merchants
Merchant Status
Merchant Creatives
Merchant Gift Cards
Edit Trail
Payment Summary
Merchant Search
Merchant Search by Product
Ledger Report
Example
Use Activity Details to download transaction
data daily and store in your tracking system or
email you your commissions.
Trans ID|User ID|Merchant ID|Trans
Date|Trans
Amount|Commission|Comment|Voided|Pendin
g Date|Locked|Aff Comment|Banner
Page|Reversal Date|Click Date|Click
Time|Banner Id
37697968|132296|8723|10/16/2012 11:41:05
AM|323.7|71.21|Sale - 620946||||WCG45500|http://www.wineclubreviewsandratings.
com/cellars-wine-club/sparkling-champagneclub-review||2012-10-16 00:00:00.0|11:34:11
AM|43027
Example
Use Coupon / Deal Merchants to download
coupons to show on your website
Deal Id|Merchant Id|Merchant|Start Date|End
Date|Publish Date|Title|Image(big)|Tracking
URL|Image(small)
|Category|Description|Restrictions|Keywords|C
oupon Code|Edit Date
12104|8684|Checks Unlimited|2009-06-15 00:
00:00.0|2050-12-31 00:00:00.0|2008-08-23 18:
09:10.0|Personal checks, additional 10% off
reorder check pricing.|http://|http://www.
shareasale.com/u.cfm?
d=12104&m=8684&u=132296|http://||Personal
checks only - additional 10% off reorder check
pricing default online.|||PJKA|2009-06-18 12:
26:34.0
Other Affiliate API Uses
● Get Products
○ Search by keyword
to return products for
a datafeed site

● Invalid Links
○ Make sure you’re not
wasting your traffic

● Merchant Status
○ Be alerted when
merchants go offline

● Merchant Creatives
○ Get the latest
banners from
merchants who run
seasonal offers
What Do I Do Now?
● Process the data
○
○
○

See fgetcsv(), split(), explode()
Save to database
Send an email

● Automate your script
○

Set up a “cron” to have the script run on a regular basis

● More help?
○
○

http://www.ericnagel.com/how-to-tips/shareasale-api.html
■ 4 years old, but it still works.
http://www.ericnagel.com/how-to-tips/shareasale-prosper202.html
■ If you use Prosper202
Tips
● You have limited API calls. Use them wisely.
○ 200 / month = less than 7 per day
i.
ii.
iii.
iv.
v.
vi.

Activity Details
Traffic
Get Products
Invalid Links
Coupon / Deal Merchants
Merchant Status
Tips
● While you’re writing your script to process
the data, download the data once, then use
the local file for processing. This way, only 1
API call will be used.
○

$cURL = 'https://shareasale.com/x.cfm?
action=couponDeals&affiliateId=132296&token=az7bFTu3LwioXNRA
&XMLFormat=0';
// $cURL = 'sas.csv';
$fp = fopen($cURL, "r");
Tips
Since we’re talking about APIs, why not combine a
merchant’s direct API with the ShareASale API?
● Get data from merchant’s own API
● Change links to ShareASale Deeplinks
● …
● Profit
http://www.wyzant.com/AffiliateProgram/
Resources
●

http://blog.shareasale.com/author/ryan/
○ Ryan Frey writes about using all the ShareASale techie things

●

http://www.ericnagel.com/tag/shareasale
○ I have a few blog posts about ShareASale - keep digging

●

http://www.programmableweb.com/api/shareasale-affiliate
○ Programmable Web is all things API
Questions?
Eric Nagel
Email: eric@ericnagel.com
Website: www.ericnagel.com
Twitter: @ericnagel

More Related Content

What's hot

презентация зрожевська н.м.
презентация зрожевська н.м.презентация зрожевська н.м.
презентация зрожевська н.м.zrozhevska
 
"Фарбований шакал". Індійська народна казка
"Фарбований шакал". Індійська народна казка "Фарбований шакал". Індійська народна казка
"Фарбований шакал". Індійська народна казка DorokhGala
 
A.Конан Дойль. Життя як детектив.
A.Конан Дойль. Життя як детектив.A.Конан Дойль. Життя як детектив.
A.Конан Дойль. Життя як детектив.DorokhGala
 
Pupils book
Pupils bookPupils book
Pupils bookSkyEdge
 
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...Simplilearn
 
Sequence and Traverse - Part 2
Sequence and Traverse - Part 2Sequence and Traverse - Part 2
Sequence and Traverse - Part 2Philip Schwarz
 
Романтизм
РомантизмРомантизм
Романтизмenka2017
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginningAnis Ahmad
 
The Image that called me - Active Content Injection with SVG Files
The Image that called me - Active Content Injection with SVG FilesThe Image that called me - Active Content Injection with SVG Files
The Image that called me - Active Content Injection with SVG FilesMario Heiderich
 
Дж.Р.Кіплінг "Брати Мауглі"
Дж.Р.Кіплінг "Брати Мауглі"Дж.Р.Кіплінг "Брати Мауглі"
Дж.Р.Кіплінг "Брати Мауглі"Adriana Himinets
 
Чарівний світ казок Вільгельма Гауфа
Чарівний світ казок Вільгельма ГауфаЧарівний світ казок Вільгельма Гауфа
Чарівний світ казок Вільгельма ГауфаІнна Мельник
 
Роберт Льюїс Стівенсон. Презентація.
Роберт Льюїс Стівенсон. Презентація.Роберт Льюїс Стівенсон. Презентація.
Роберт Льюїс Стівенсон. Презентація.DorokhGala
 
JSON-LD, Schema.org, and Structured data
JSON-LD, Schema.org, and Structured dataJSON-LD, Schema.org, and Structured data
JSON-LD, Schema.org, and Structured dataSante J. Achille
 
презентація Конан Дойл 7 клас
презентація Конан Дойл 7 класпрезентація Конан Дойл 7 клас
презентація Конан Дойл 7 класdfktynbyf15
 

What's hot (20)

презентация зрожевська н.м.
презентация зрожевська н.м.презентация зрожевська н.м.
презентация зрожевська н.м.
 
"Фарбований шакал". Індійська народна казка
"Фарбований шакал". Індійська народна казка "Фарбований шакал". Індійська народна казка
"Фарбований шакал". Індійська народна казка
 
A.Конан Дойль. Життя як детектив.
A.Конан Дойль. Життя як детектив.A.Конан Дойль. Життя як детектив.
A.Конан Дойль. Життя як детектив.
 
Pupils book
Pupils bookPupils book
Pupils book
 
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
Docker Tutorial For Beginners | What Is Docker And How It Works? | Docker Tut...
 
Sequence and Traverse - Part 2
Sequence and Traverse - Part 2Sequence and Traverse - Part 2
Sequence and Traverse - Part 2
 
Романтизм
РомантизмРомантизм
Романтизм
 
Interchange intro-workbook
Interchange intro-workbookInterchange intro-workbook
Interchange intro-workbook
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
MongoDB Workshop
MongoDB WorkshopMongoDB Workshop
MongoDB Workshop
 
The Image that called me - Active Content Injection with SVG Files
The Image that called me - Active Content Injection with SVG FilesThe Image that called me - Active Content Injection with SVG Files
The Image that called me - Active Content Injection with SVG Files
 
Жниварські пісні.
Жниварські пісні.Жниварські пісні.
Жниварські пісні.
 
Дж.Р.Кіплінг "Брати Мауглі"
Дж.Р.Кіплінг "Брати Мауглі"Дж.Р.Кіплінг "Брати Мауглі"
Дж.Р.Кіплінг "Брати Мауглі"
 
Чарівний світ казок Вільгельма Гауфа
Чарівний світ казок Вільгельма ГауфаЧарівний світ казок Вільгельма Гауфа
Чарівний світ казок Вільгельма Гауфа
 
Роберт Льюїс Стівенсон. Презентація.
Роберт Льюїс Стівенсон. Презентація.Роберт Льюїс Стівенсон. Презентація.
Роберт Льюїс Стівенсон. Презентація.
 
Go lang
Go langGo lang
Go lang
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
JS Event Loop
JS Event LoopJS Event Loop
JS Event Loop
 
JSON-LD, Schema.org, and Structured data
JSON-LD, Schema.org, and Structured dataJSON-LD, Schema.org, and Structured data
JSON-LD, Schema.org, and Structured data
 
презентація Конан Дойл 7 клас
презентація Конан Дойл 7 класпрезентація Конан Дойл 7 клас
презентація Конан Дойл 7 клас
 

Viewers also liked

Viewers also liked (20)

OCRFeeder (FOSDEM 2010)
OCRFeeder (FOSDEM 2010)OCRFeeder (FOSDEM 2010)
OCRFeeder (FOSDEM 2010)
 
New Forests for New People
New Forests for New PeopleNew Forests for New People
New Forests for New People
 
BPE USA agenda - Full Agenda
BPE USA agenda - Full AgendaBPE USA agenda - Full Agenda
BPE USA agenda - Full Agenda
 
Streams API (Web Engines Hackfest 2015)
Streams API (Web Engines Hackfest 2015)Streams API (Web Engines Hackfest 2015)
Streams API (Web Engines Hackfest 2015)
 
MakkelijkLezenPlein deel 2 Theek 5
MakkelijkLezenPlein deel 2 Theek 5MakkelijkLezenPlein deel 2 Theek 5
MakkelijkLezenPlein deel 2 Theek 5
 
セミナープレゼン資料【Adingo】 20130530 
セミナープレゼン資料【Adingo】 20130530 セミナープレゼン資料【Adingo】 20130530 
セミナープレゼン資料【Adingo】 20130530 
 
Oipf
OipfOipf
Oipf
 
Presentatie handicap en studie
Presentatie handicap en studiePresentatie handicap en studie
Presentatie handicap en studie
 
DCU School of Physical Sciences
DCU School of Physical SciencesDCU School of Physical Sciences
DCU School of Physical Sciences
 
Hbbtv
HbbtvHbbtv
Hbbtv
 
MMD_Vision 2015
MMD_Vision 2015MMD_Vision 2015
MMD_Vision 2015
 
Gabor Karcis portfolio
Gabor Karcis portfolioGabor Karcis portfolio
Gabor Karcis portfolio
 
Почта ukr.net
 Почта ukr.net Почта ukr.net
Почта ukr.net
 
KW Outfront Magazine Online March/April 2009
KW Outfront Magazine Online  March/April 2009KW Outfront Magazine Online  March/April 2009
KW Outfront Magazine Online March/April 2009
 
9. Il Web semantico
9. Il Web semantico9. Il Web semantico
9. Il Web semantico
 
Baqmar 2014
Baqmar 2014Baqmar 2014
Baqmar 2014
 
SAPIENS2009 - Module 4B
SAPIENS2009 - Module 4BSAPIENS2009 - Module 4B
SAPIENS2009 - Module 4B
 
Fas drs power_point_2003
Fas drs power_point_2003Fas drs power_point_2003
Fas drs power_point_2003
 
In just five years 2011
In just five years 2011In just five years 2011
In just five years 2011
 
Deloitte Telecom Predictions 2010
Deloitte Telecom Predictions 2010Deloitte Telecom Predictions 2010
Deloitte Telecom Predictions 2010
 

Similar to Best ways to use the ShareASale API

Preparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for TranslationPreparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for TranslationBrian Hogg
 
API Technical Writing
API Technical WritingAPI Technical Writing
API Technical WritingSarah Maddox
 
Metrics-Driven Engineering
Metrics-Driven EngineeringMetrics-Driven Engineering
Metrics-Driven EngineeringMike Brittain
 
Brian hogg word camp preparing a plugin for translation
Brian hogg   word camp preparing a plugin for translationBrian hogg   word camp preparing a plugin for translation
Brian hogg word camp preparing a plugin for translationwcto2017
 
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015Codemotion
 
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop Apigee | Google Cloud
 
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...Serge Huber
 
Apache Unomi presentation and update. By Serge Huber, CTO Jahia
Apache Unomi presentation and update. By Serge Huber, CTO JahiaApache Unomi presentation and update. By Serge Huber, CTO Jahia
Apache Unomi presentation and update. By Serge Huber, CTO JahiaJahia Solutions Group
 
Lectura 2.4 is your api naked - 10 roadmap considerations
Lectura 2.4   is your api naked - 10 roadmap considerationsLectura 2.4   is your api naked - 10 roadmap considerations
Lectura 2.4 is your api naked - 10 roadmap considerationsMatias Menendez
 
REST API: A Real Case Scenario
REST API: A Real Case ScenarioREST API: A Real Case Scenario
REST API: A Real Case Scenariociacchi
 
PHP Experience 2016 - [Workshop] Elastic Search: Turbinando sua aplicação PHP
PHP Experience 2016 - [Workshop] Elastic Search: Turbinando sua aplicação PHPPHP Experience 2016 - [Workshop] Elastic Search: Turbinando sua aplicação PHP
PHP Experience 2016 - [Workshop] Elastic Search: Turbinando sua aplicação PHPiMasters
 
Webinar: API Extravaganza! Combining Google Analytics and ORCID API
Webinar: API Extravaganza! Combining Google Analytics and ORCID APIWebinar: API Extravaganza! Combining Google Analytics and ORCID API
Webinar: API Extravaganza! Combining Google Analytics and ORCID APIARDC
 
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017Amazon Web Services
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsTom Johnson
 
Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Katy Slemon
 
Introduction to trader bots with Python
Introduction to trader bots with PythonIntroduction to trader bots with Python
Introduction to trader bots with Pythonroskakori
 
Customer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
Customer Automation Masterclass - Workshop 1: Data Enrichment using ClearbitCustomer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
Customer Automation Masterclass - Workshop 1: Data Enrichment using ClearbitJanBogaert8
 

Similar to Best ways to use the ShareASale API (20)

Preparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for TranslationPreparing a WordPress Plugin for Translation
Preparing a WordPress Plugin for Translation
 
API Technical Writing
API Technical WritingAPI Technical Writing
API Technical Writing
 
Metrics-Driven Engineering
Metrics-Driven EngineeringMetrics-Driven Engineering
Metrics-Driven Engineering
 
Brian hogg word camp preparing a plugin for translation
Brian hogg   word camp preparing a plugin for translationBrian hogg   word camp preparing a plugin for translation
Brian hogg word camp preparing a plugin for translation
 
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
Building Successful APIs Overnight - Orlando K - Codemotion Rome 2015
 
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
 
Tweak Geeks #FOS15
Tweak Geeks #FOS15Tweak Geeks #FOS15
Tweak Geeks #FOS15
 
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
ApacheCon NA 2018 : Apache Unomi, an Open Source Customer Data Platformapache...
 
Apache Unomi presentation and update. By Serge Huber, CTO Jahia
Apache Unomi presentation and update. By Serge Huber, CTO JahiaApache Unomi presentation and update. By Serge Huber, CTO Jahia
Apache Unomi presentation and update. By Serge Huber, CTO Jahia
 
Lectura 2.4 is your api naked - 10 roadmap considerations
Lectura 2.4   is your api naked - 10 roadmap considerationsLectura 2.4   is your api naked - 10 roadmap considerations
Lectura 2.4 is your api naked - 10 roadmap considerations
 
REST API: A Real Case Scenario
REST API: A Real Case ScenarioREST API: A Real Case Scenario
REST API: A Real Case Scenario
 
PHP Experience 2016 - [Workshop] Elastic Search: Turbinando sua aplicação PHP
PHP Experience 2016 - [Workshop] Elastic Search: Turbinando sua aplicação PHPPHP Experience 2016 - [Workshop] Elastic Search: Turbinando sua aplicação PHP
PHP Experience 2016 - [Workshop] Elastic Search: Turbinando sua aplicação PHP
 
CiviCRM API v3
CiviCRM API v3CiviCRM API v3
CiviCRM API v3
 
CGI Presentation
CGI PresentationCGI Presentation
CGI Presentation
 
Webinar: API Extravaganza! Combining Google Analytics and ORCID API
Webinar: API Extravaganza! Combining Google Analytics and ORCID APIWebinar: API Extravaganza! Combining Google Analytics and ORCID API
Webinar: API Extravaganza! Combining Google Analytics and ORCID API
 
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
How to Build a Backend for an Alexa Smart Home Skill - ALX316 - re:Invent 2017
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIs
 
Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)Go swagger tutorial how to create golang api documentation using go swagger (1)
Go swagger tutorial how to create golang api documentation using go swagger (1)
 
Introduction to trader bots with Python
Introduction to trader bots with PythonIntroduction to trader bots with Python
Introduction to trader bots with Python
 
Customer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
Customer Automation Masterclass - Workshop 1: Data Enrichment using ClearbitCustomer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
Customer Automation Masterclass - Workshop 1: Data Enrichment using Clearbit
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

Recently uploaded (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Best ways to use the ShareASale API

  • 1. Best Ways to Use the API ShareASale Think Tank 2013 Eric Nagel eric@ericnagel.com
  • 2. What is the ShareASale API? ● API = Application Programming Interface ○ An application programming interface (API) specifies how some software components should interact with each other. ○ It’s a way for your website to talk directly to the ShareASale system ● Affiliate API ● Merchant API
  • 3. Where to find the ShareASale API Affiliate API Under Tools Merchant API Under Tools
  • 4. Affiliate API: Authentication The Authentication Hash Authentication Hash : SHA-256 Hash in 64 character Hex format of the string "YourAPIToken:CurrentDateInUTCFormat: APIActionValue:YourAPISecret" (without quotes) For example, for following values: Token: NGc6dg5e9URups5o API Secret: ATj7vd8b7CCjeq9yQUo8cc2w3OThqe2e String to Hash: NGc6dg5e9URups5o:Thu, 14 Apr 2011 22:44:22 GMT:bannerList:ATj7vd8b7CCjeq9yQUo8cc2w3OThqe2e UTC Date: Thu, 14 Apr 2011 22:44:22 GMT API Action: bannerList The correct HTTP Headers would be: x-ShareASale-Date: Thu, 14 Apr 2011 22:44:22 GMT x-ShareASale-Authentication: 78D54A3051AE0AAAF022AA2DA230B97D5219D82183FEFF71E2D53DEC6057D9F1
  • 5. Affiliate API: Authentication IP Restrictions Start > Run cmd ping domain.com Gives you the IP These are the IPs that will be accessing the data. Since the script will reside on your server, use your server’s IP.
  • 6. Affiliate API: Authentication HUH???? Don’t worry. 1. Click “View Sample code in PHP” 2. Copy 3. Paste 4. Change values
  • 7. Affiliate API: Sample <?php $myAffiliateID = ''; Get these values from the API page $APIToken = ""; $APISecretKey = ""; $myTimeStamp = gmdate(DATE_RFC1123); $APIVersion = 1.8; We’ll get to this $actionVerb = "activity"; $sig = $APIToken.':'.$myTimeStamp.':'.$actionVerb.':'.$APISecretKey; $sigHash = hash("sha256",$sig); $myHeaders = array("x-ShareASale-Date: $myTimeStamp","x-ShareASale-Authentication: $sigHash");
  • 8. Affiliate API: Sample $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://shareasale.com/x.cfm? affiliateId=$myAffiliateID&token=$APIToken&version=$APIVersion&action=$actionVerb"); curl_setopt($ch, CURLOPT_HTTPHEADER,$myHeaders); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HEADER, 0); $returnResult = curl_exec($ch); Nothing to do here.
  • 9. Affiliate API: Sample if ($returnResult) { //parse HTTP Body to determine result of request if (stripos($returnResult,"Error Code ")) { // error occurred trigger_error($returnResult,E_USER_ERROR); } else{ // success echo $returnResult; } This is where you take over and put in your custom coding to do whatever you want with the data. } else{ // connection error trigger_error(curl_error($ch),E_USER_ERROR); }
  • 10. Affiliate API ● ● ● ● ● ● ● ● ● ● Activity Details Activity Summary Merchant Timespan Report Today's Stats Monthly Summary Void Trail Traffic API Token Count Get Products Invalid Links ● ● ● ● ● ● ● ● ● ● Datafeed Merchants Coupon/Deal Merchants Merchant Status Merchant Creatives Merchant Gift Cards Edit Trail Payment Summary Merchant Search Merchant Search by Product Ledger Report
  • 11. Example Use Activity Details to download transaction data daily and store in your tracking system or email you your commissions. Trans ID|User ID|Merchant ID|Trans Date|Trans Amount|Commission|Comment|Voided|Pendin g Date|Locked|Aff Comment|Banner Page|Reversal Date|Click Date|Click Time|Banner Id 37697968|132296|8723|10/16/2012 11:41:05 AM|323.7|71.21|Sale - 620946||||WCG45500|http://www.wineclubreviewsandratings. com/cellars-wine-club/sparkling-champagneclub-review||2012-10-16 00:00:00.0|11:34:11 AM|43027
  • 12. Example Use Coupon / Deal Merchants to download coupons to show on your website Deal Id|Merchant Id|Merchant|Start Date|End Date|Publish Date|Title|Image(big)|Tracking URL|Image(small) |Category|Description|Restrictions|Keywords|C oupon Code|Edit Date 12104|8684|Checks Unlimited|2009-06-15 00: 00:00.0|2050-12-31 00:00:00.0|2008-08-23 18: 09:10.0|Personal checks, additional 10% off reorder check pricing.|http://|http://www. shareasale.com/u.cfm? d=12104&m=8684&u=132296|http://||Personal checks only - additional 10% off reorder check pricing default online.|||PJKA|2009-06-18 12: 26:34.0
  • 13. Other Affiliate API Uses ● Get Products ○ Search by keyword to return products for a datafeed site ● Invalid Links ○ Make sure you’re not wasting your traffic ● Merchant Status ○ Be alerted when merchants go offline ● Merchant Creatives ○ Get the latest banners from merchants who run seasonal offers
  • 14. What Do I Do Now? ● Process the data ○ ○ ○ See fgetcsv(), split(), explode() Save to database Send an email ● Automate your script ○ Set up a “cron” to have the script run on a regular basis ● More help? ○ ○ http://www.ericnagel.com/how-to-tips/shareasale-api.html ■ 4 years old, but it still works. http://www.ericnagel.com/how-to-tips/shareasale-prosper202.html ■ If you use Prosper202
  • 15. Tips ● You have limited API calls. Use them wisely. ○ 200 / month = less than 7 per day i. ii. iii. iv. v. vi. Activity Details Traffic Get Products Invalid Links Coupon / Deal Merchants Merchant Status
  • 16. Tips ● While you’re writing your script to process the data, download the data once, then use the local file for processing. This way, only 1 API call will be used. ○ $cURL = 'https://shareasale.com/x.cfm? action=couponDeals&affiliateId=132296&token=az7bFTu3LwioXNRA &XMLFormat=0'; // $cURL = 'sas.csv'; $fp = fopen($cURL, "r");
  • 17. Tips Since we’re talking about APIs, why not combine a merchant’s direct API with the ShareASale API? ● Get data from merchant’s own API ● Change links to ShareASale Deeplinks ● … ● Profit http://www.wyzant.com/AffiliateProgram/
  • 18. Resources ● http://blog.shareasale.com/author/ryan/ ○ Ryan Frey writes about using all the ShareASale techie things ● http://www.ericnagel.com/tag/shareasale ○ I have a few blog posts about ShareASale - keep digging ● http://www.programmableweb.com/api/shareasale-affiliate ○ Programmable Web is all things API
  • 19. Questions? Eric Nagel Email: eric@ericnagel.com Website: www.ericnagel.com Twitter: @ericnagel