Automate eBay Analytics Integration Tasks from PowerShell

Ready to get started?

Download for a free trial:

Download Now

Learn more:

eBay Analytics ADO.NET Provider

Rapidly create and deploy powerful .NET applications that integrate with eBay Analytics.

Are you looking for a quick and easy way to access eBay Analytics data from PowerShell? We show how to use the Cmdlets for eBay Analytics and the CData ADO.NET Provider for eBay Analytics to connect to eBay Analytics data and synchronize, automate, download, and more.

The CData Cmdlets for eBay Analytics are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to eBay Analytics.

Cmdlets or ADO.NET?

The cmdlets are not only a PowerShell interface to the eBay Analytics API, but also an SQL interface; this tutorial shows how to use both to retrieve eBay Analytics data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for eBay Analytics. To access eBay Analytics data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for eBay Analytics.

After obtaining the needed connection properties, accessing eBay Analytics data in PowerShell consists of three basic steps.

You can authenticate to eBay Analytics only via the OAuth 2 authentication method. The eBay Analytics API requires an access token created with the authorization code grant flow to authorize the requests.

You can follow the guide in the Help documentation for a step by step guide on how to authenticate using the OAuth 2 protocol.


  1. Install the module:

    Install-Module EbayAnalyticsCmdlets
  2. Connect:

    $ebayanalytics = Connect-EbayAnalytics -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -RuName "$RuName"
  3. Search for and retrieve data:

    $listingid = "201284405428" $trafficreportbylisting = Select-EbayAnalytics -Connection $ebayanalytics -Table "TrafficReportByListing" -Where "ListingId = `'$ListingId`'" $trafficreportbylisting

    You can also use the Invoke-EbayAnalytics cmdlet to execute SQL commands:

    $trafficreportbylisting = Invoke-EbayAnalytics -Connection $ebayanalytics -Query 'SELECT * FROM TrafficReportByListing WHERE ListingId = @ListingId' -Params @{'@ListingId'='201284405428'}


  1. Load the provider's assembly:

    [Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for eBay Analytics\lib\System.Data.CData.EbayAnalytics.dll")
  2. Connect to eBay Analytics:

    $conn= New-Object System.Data.CData.EbayAnalytics.EbayAnalyticsConnection("OAuthClientId=MyAppID;OAuthClientSecret=MyCertID;RuName=MyRuName;InitiateOAuth=GETANDREFRESH") $conn.Open()
  3. Instantiate the EbayAnalyticsDataAdapter, execute an SQL query, and output the results:

    $sql="SELECT ListingName, ClickThroughRate from TrafficReportByListing" $da= New-Object System.Data.CData.EbayAnalytics.EbayAnalyticsDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.listingname $_.clickthroughrate }