API Building Blocks
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 automatically.
Â
Â
Step 1: What do you want to do?
Select the 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 can do just that.
You can grab all the new banners without having to ever log in with the Merchant Creatives API request.
Â
Â
Step 2: Requirements – Create the URL Request
All API requests are basically a URL. 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 the 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: An Example
Working through a Today’s Stats transaction API request, we have the following so far:
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:
Â
Â
Step 4: Final TouchÂ
ShareASale’s API also requires you to 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 set up, no more work is necessary.
Copyright ShareASale 2021