Many Affiliates could benefit from the ShareASale API’s powerful tools. The API can answer a number of different questions, the most popular being:
-
Who are your best Merchants?
-
What are the new banners, deals, and products among them?
-
Do you have any links that are invalid and should be fixed?
You can use the API to have all that information delivered auto-magically!
Since it’s naturally technical, let’s go through the steps to using an API request.
Step 1 (with more detail): What do you want to do?
Pick what task you’d like to perform on ShareASale. Do you need a report of your daily stats in real-time? Try out the Today’s Stats report. For a broader view, the Monthly Summary will reveal your highest grossing commissions among Merchants in a period.
Are you looking to find Merchants who have products based on a certain keyword? The Merchant Search by Product API is perfect for the job (more: here).
Finally, if a big holiday is coming up you could grab all the new banners without having to ever login with the Merchant Creatives API request.
All API requests are basically a URL – you might be familiar with something similar when navigating the web.
Step 2 (with more detail): Requirements – Create the URL Request
All API requests are basically a URL – you might be familiar with something similar when navigating the web. When you type in the URL ‘www.facebook.com’ you’re requesting information from Facebook. For the ShareASale Affiliate API your URL is ‘https://shareasale.com/x.cfm’ instead.
However, with an API request instead of the browser receiving a web page for a human, it’s a script receiving data for a computer. Let’s first create the URL:
Start with: https://shareasale.com/x.cfm
All requests must contain:
- ?affiliateID= your Affiliate ID number
- &token= unique alphanumeric token received when account is set up for API use. Check your settings for yours.
- &action= one of the supported actions (dailyActivity, monthlySummary, etc. from step 1 above)
- &version= currently 1.7
Step 3 (with more detail): An Example
Working through a Today’s Stats transaction API request, we have the following so far:
https://shareasale.com/x.cfm?affiliateId=YourAffiliateID&token=abcDE1&action=dailyActivity&version=1.7
Hold on! You can include more than just those API parameters. A Today’s Stats API request also can include these:
- &sortcol= the column you would like the data returned ordered, default on commissions
- &sortdir= ASC for ascending, DESC for descending sort direction
- &XMLFormat=0 for delimited, 1 for XML format data
To pull Today’s Stats in XML format sorted by hits descendingly, here’s what we’d create:
https://shareasale.com/x.cfm?affiliateId=YourAffiliateID&token=abcDE1&action=dailyActivity&version=1.7&sortcol=hits&sortdir=desc&XMLFormat=1
Step 4: Final Touch
ShareASale’s API also requires you prove you really are the correct Affiliate. You wouldn’t want just anyone to be able to retrieve your commission info or determine your best converting Merchants!
So, every request requires authentication. You can set only certain IP addresses to gain access, and/or send a special encoded authentication string with your request depending on the API version.
This is a bit technical, so read more on our Affiliate API settings page (Tools >> Affiliate API) including sample code to get you started. Once the authentication is setup, no more work is necessary.
Liz says
August 24, 2013 at 10:24 pmThanks for doing this post. I want to try and build a custom widget to show my current sales on my Cyfe dashboard. This article is a good start.