You may be an eBay Partner, but did you know you can access your eBay affiliate data by its API?

It is very simple to get started.

Get your eBay Account SID to perform powerful analysis with Python

Access any report in your eBay Partner Dashboard and click the cloud icon, enable the eBay API and get your account SID

Find a report and click cloud icon top right corner

Click ‘Enable API Access Now’ button

Copy your Account SID you will need it later for your Python code

Open up any eBay report and click the cloud icon to get the JSON url for that report. Copy that JSON url to make customized Python applications. These urls contain your account SID, start and end date.

You can use Python to query the JSON urls that are available for any report.

https://' + account_SID + ‘:6%7EgfUXpQahdAw_7XchcbfmxRNwduAxtg@api.partner.ebay.com/Mediapartners/IRUCAiHA8PyS1543670pjDEJATNbPYPbD1/Reports/ebay_partner_perf_by_month_v2.json?TRAFFIC_TYPE=0&CHECKOUT_SITE=0&CAMPAIGN_SOLR=0&START_DATE=’+ start_date +’&END_DATE=’ + end_date + ‘&timeRange=CUSTOM&compareEnabled=false

Want results like this?

Below is a simple piece of code I put together to extract earnings by month.

import json
import requests
from datetime import date
today = date.today()print(" — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — ")
print("Monthly Earnings Upto Today's date:", today)
account_SID ='put your account SID HERE'start_date = '2014–01–01'
end_date = str(today)
r = requests.get('https://' + account_SID + ':6%7EgfUXpQahdAw_7XchcbfmxRNwduAxtg@api.partner.ebay.com/Mediapartners/IRUCAiHA8PyS1543670pjDEJATNbPYPbD1/Reports/ebay_partner_perf_by_month_v2.json?TRAFFIC_TYPE=0&CHECKOUT_SITE=0&CAMPAIGN_SOLR=0&START_DATE='+ start_date +'&END_DATE=' + end_date + '&timeRange=CUSTOM&compareEnabled=false')r = r.json()jdict = r.get('Records')print(" — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — ")print('{:_<14} {:_>8} {:_>10} {:_>13} {:_>10} {:_>8}{:_>12}'.format('MONTH','EARNINGS','CLICKS','ITEMS ORDERED','SALES','AIV','TRANSACTIONS')) for row in jdict:
earnings = float(row['Earnings'])
earnings = int(earnings)
month = row['Month']
clicks = row['Clicks']
sales = float(row['Sales'])
sales = round(sales,2)
AIV = float(row['AIV'])
AIV = round(AIV,2)
ItemsOrdered = row['ItemsOrdered']
Transactions = row['Transactions']
print('{:_<14} {:_>8} {:_>10} {:_>13} {:_>10} {:_>8} {:_>12}'.format(month,earnings,clicks,ItemsOrdered,sales,AIV,Transactions))print(" — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — ")

Thank you for reading. Follow me on medium for more examples of using Python to access data in the eBay Partner API program.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store