Automate Amazon Marketplace Integration Tasks from PowerShell
The CData ADO.NET Provider for Amazon Marketplace is a standard ADO.NET Provider that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Amazon Marketplace.
ADO.NET Provider
The ADO.NET Provider provides a SQL interface for Amazon Marketplace; this tutorial shows how to use the Provider to retrieve Amazon Marketplace data.
Once you have acquired the necessary connection properties, accessing Amazon Marketplace data in PowerShell can be enabled in three steps.
To connect to the Amazon Marketplace Webservice (MWS), AWSAccessKeyId, MWSAuthToken, AWSSecretKey and SellerId are required. You can optionally set the Marketplace property. For more information on obtaining values for these properties, refer to the Help documentation.
-
Load the provider's assembly:
[Reflection.Assembly]::LoadFile("C:\Program Files\CData\CData ADO.NET Provider for Amazon Marketplace\lib\System.Data.CData.AmazonMarketplace.dll") -
Connect to Amazon Marketplace:
$conn= New-Object System.Data.CData.AmazonMarketplace.AmazonMarketplaceConnection("AWS Access Key Id=myAWSAccessKeyId;AWS Secret Key=myAWSSecretKey;MWS Auth Token=myMWSAuthToken;Seller Id=mySellerId;Marketplace=United States;") $conn.Open() -
Instantiate the AmazonMarketplaceDataAdapter, execute an SQL query, and output the results:
$sql="SELECT AmazonOrderId, OrderStatus from Orders" $da= New-Object System.Data.CData.AmazonMarketplace.AmazonMarketplaceDataAdapter($sql, $conn) $dt= New-Object System.Data.DataTable $da.Fill($dt) $dt.Rows | foreach { Write-Host $_.amazonorderid $_.orderstatus }