![]() |
VOOZH | about |
The CData Cmdlets for Amazon Marketplace are standard PowerShell cmdlets that make it easy to accomplish data cleansing, normalization, backup, and other integration tasks by enabling real-time access to Amazon Marketplace.
The Cmdlets are not only a PowerShell interface to Amazon Marketplace, but also an SQL interface; this tutorial shows how to use both to retrieve Amazon Marketplace data. We also show examples of the ADO.NET equivalent, which is possible with the CData ADO.NET Provider for Amazon Marketplace. To access Amazon Marketplace data from other .NET applications, like LINQPad, use the CData ADO.NET Provider for Amazon Marketplace.
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.
Install the module:
Install-Module AmazonMarketplaceCmdlets
Connect:
$amazonmarketplace = Connect-AmazonMarketplace -AWS Access Key Id "$AWS Access Key Id" -AWS Secret Key "$AWS Secret Key" -MWS Auth Token "$MWS Auth Token" -Seller Id "$Seller Id" -Marketplace "$Marketplace"
Search for and retrieve data:
$isreplacementorder = "True" $orders = Select-AmazonMarketplace -Connection $amazonmarketplace -Table "Orders" -Where "IsReplacementOrder = `'$IsReplacementOrder`'" $orders
You can also use the Invoke-AmazonMarketplace cmdlet to execute SQL commands:
$orders = Invoke-AmazonMarketplace -Connection $amazonmarketplace -Query 'SELECT * FROM Orders WHERE IsReplacementOrder = @IsReplacementOrder' -Params @{'@IsReplacementOrder'='True'}
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
}
Download a free trial of the Amazon Marketplace Data Provider to get started:
Download NowLearn more:
👁 Amazon Marketplace IconRapidly create and deploy powerful .NET applications that integrate with Amazon Marketplace data including InventoryItems, Orders, Products, and more!