![]() |
VOOZH | about |
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.
The Cmdlets are not only a PowerShell interface to eBay Analytics, 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.
Once you have acquired the necessary connection properties, accessing eBay Analytics data in PowerShell can be enabled in three 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.
Install the module:
Install-Module EbayAnalyticsCmdlets
Connect:
$ebayanalytics = Connect-EbayAnalytics -OAuthClientId "$OAuthClientId" -OAuthClientSecret "$OAuthClientSecret" -RuName "$RuName" -InitiateOAuth "$InitiateOAuth"
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'}
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")
Connect to eBay Analytics:
$conn= New-Object System.Data.CData.EbayAnalytics.EbayAnalyticsConnection("OAuthClientId=MyAppID;OAuthClientSecret=MyCertID;RuName=MyRuName;InitiateOAuth=GETANDREFRESH;")
$conn.Open()
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
}
Download a free trial of the eBay Analytics Data Provider to get started:
Download NowLearn more:
👁 eBay Analytics IconRapidly create and deploy powerful .NET applications that integrate with eBay Analytics.