CSharpAmazonSpAPI 1.0.34

There is a newer version of this package available.
See the version list below for details.
dotnet add package CSharpAmazonSpAPI --version 1.0.34
                    
NuGet\Install-Package CSharpAmazonSpAPI -Version 1.0.34
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CSharpAmazonSpAPI" Version="1.0.34" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSharpAmazonSpAPI" Version="1.0.34" />
                    
Directory.Packages.props
<PackageReference Include="CSharpAmazonSpAPI" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CSharpAmazonSpAPI --version 1.0.34
                    
#r "nuget: CSharpAmazonSpAPI, 1.0.34"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CSharpAmazonSpAPI@1.0.34
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CSharpAmazonSpAPI&version=1.0.34
                    
Install as a Cake Addin
#tool nuget:?package=CSharpAmazonSpAPI&version=1.0.34
                    
Install as a Cake Tool

Amazon Selling Partner API C# Build status NuGet Gitter Chat

This is an API Binding in .Net C# for the new Amazon Selling Partner API.

This library is based on the output of swagger-codegen with the OpenAPI files provided by Amazon and has been modified by the contributors.

The purpose of this package is to have an easy way of getting started with the Amazon Selling Partner API using C#, you can watch this Youtube video for easy start your project


Requirements


Tasks

Seller
Vendor

Installation NuGet

Install-Package CSharpAmazonSpAPI

Keys

Name Description
AccessKey AWS USER ACCESS KEY
SecretKey AWS USER SECRET KEY
RoleArn AWS IAM Role ARN (needs permission to “Assume Role” STS)
Region Marketplace region
ClientId Your amazon app id
ClientSecret Your amazon app secret
RefreshToken Check how to get RefreshToken

For more information about keys please check Amazon Selling Partner API developer guide , If you are not registered as developer please Register to be able to create application.


Usage

Configuration

AmazonConnection amazonConnection = new AmazonConnection(new AmazonCredential()
{
     AccessKey = "AKIAXXXXXXXXXXXXXXX",
     SecretKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
     RoleArn = "arn:aws:iam::XXXXXXXXXXXXX:role/XXXXXXXXXXXX",
     ClientId = "amzn1.application-XXX-client.XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
     ClientSecret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
     RefreshToken= "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
     MarketPlace = MarketPlace.UnitedArabEmirates, //MarketPlace.GetMarketPlaceByID("A2VIGQ35RCS4UG")
});

Order List, For more orders sample please check Here.

ParameterOrderList serachOrderList = new ParameterOrderList();
serachOrderList.CreatedAfter = DateTime.UtcNow.AddMinutes(-600000);
serachOrderList.OrderStatuses = new List<OrderStatuses>();
serachOrderList.OrderStatuses.Add(OrderStatuses.Canceled);
var orders = amazonConnection.Orders.GetOrders(serachOrderList);

Order List with parameter

ParameterOrderList serachOrderList = new ParameterOrderList();
serachOrderList.CreatedAfter = DateTime.UtcNow.AddHours(-24);
serachOrderList.OrderStatuses = new List<OrderStatuses>();
serachOrderList.OrderStatuses.Add(OrderStatuses.Unshipped);
serachOrderList.MarketplaceIds = new List<string> { MarketPlace.UnitedArabEmirates.ID };

var orders = amazonConnection.Orders.GetOrders(serachOrderList);

Order List data from Sandbox

AmazonConnection amazonConnection = new AmazonConnection(new AmazonCredential()
{
     AccessKey = "AKIAXXXXXXXXXXXXXXX",
     SecretKey = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
     RoleArn = "arn:aws:iam::XXXXXXXXXXXXX:role/XXXXXXXXXXXX",
     ClientId = "amzn1.application-XXX-client.XXXXXXXXXXXXXXXXXXXXXXXXXXXX",
     ClientSecret = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
     RefreshToken= "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
     Environment=Environments.Sandbox
});

var orders = amazonConnection.Orders.GetOrders
        (
         new FikaAmazonAPI.Parameter.Order.ParameterOrderList()
             {
              TestCase = Constants.TestCase200
             }
        );

Report List, For more report sample please check Here.

var parameters = new ParameterReportList();
parameters.pageSize = 100;
parameters.reportTypes = new List<ReportTypes>();
parameters.reportTypes.Add(ReportTypes.GET_AFN_INVENTORY_DATA);
parameters.marketplaceIds = new List<string>();
parameters.marketplaceIds.Add(MarketPlace.UnitedArabEmirates.ID);
var reports=amazonConnection.Reports.GetReports(parameters);

Custom Report

var parameters = new ParameterCreateReportSpecification();
parameters.reportType = ReportTypes.GET_FLAT_FILE_ALL_ORDERS_DATA_BY_LAST_UPDATE_GENERAL;
parameters.dataStartTime = DateTime.UtcNow.AddDays(-30);
parameters.dataEndTime = DateTime.UtcNow.AddDays(-10);
parameters.marketplaceIds = new MarketplaceIds();
parameters.marketplaceIds.Add(MarketPlace.UnitedArabEmirates.ID);
parameters.reportOptions = new AmazonSpApiSDK.Models.Reports.ReportOptions();

var report= amazonConnection.Reports.CreateReport(parameters);

Report GET_MERCHANT_LISTINGS_ALL_DATA sample

var parameters = new ParameterCreateReportSpecification();
parameters.reportType = ReportTypes.GET_MERCHANT_LISTINGS_ALL_DATA;

parameters.marketplaceIds = new MarketplaceIds();
parameters.marketplaceIds.Add(MarketPlace.UnitedArabEmirates.ID);

parameters.reportOptions = new FikaAmazonAPI.AmazonSpApiSDK.Models.Reports.ReportOptions();

var reportId = amazonConnection.Reports.CreateReport(parameters);
var filePath = string.Empty;
string ReportDocumentId = string.Empty;

while (string.IsNullOrEmpty(ReportDocumentId))
{
    Thread.Sleep(1000 * 60);
    var reportData = amazonConnection.Reports.GetReport(reportId);
    if (!string.IsNullOrEmpty(reportData.ReportDocumentId))
    {
        filePath = amazonConnection.Reports.GetReportFile(reportData.ReportDocumentId);
        break;
    }
}

//filePath for report

Product Pricing, For more Pricing sample please check Here.


var data = amazonConnection.ProductPricing.GetPricing(
    new Parameter.ProductPricing.ParameterGetPricing()
    {
        MarketplaceId = MarketPlace.UnitedArabEmirates.ID,
        Asins = new string[] { "B00CZC5F0G" }
    });

Product Competitive Price


var data = amazonConnection.ProductPricing.GetCompetitivePricing(
    new Parameter.ProductPricing.ParameterGetCompetitivePricing()
    {
        MarketplaceId = MarketPlace.UnitedArabEmirates.ID,
        Asins = new string[] { "B00CZC5F0G" },
    });

Notifications Create Destination, For more Notifications sample please check Here.


//EventBridge
var data = amazonConnection.Notification.CreateDestination(
    new Notifications.CreateDestinationRequest()
    {
        Name = "CompanyName",
        ResourceSpecification = new Notifications.DestinationResourceSpecification()
        {
            EventBridge = new Notifications.EventBridgeResourceSpecification("us-east-2", "999999999")
        }
    });

//SQS
var dataSqs = amazonConnection.Notification.CreateDestination(
    new Notifications.CreateDestinationRequest()
    {
        Name = "CompanyName_AE",
        ResourceSpecification = new Notifications.DestinationResourceSpecification
        {
            Sqs = new Notifications.SqsResource("arn:aws:sqs:us-east-2:9999999999999:NAME")
        }
    });

Notifications read messages


var SQS_URL = "https://sqs.us-east-2.amazonaws.com/9999999999999/IUSER_SQS";
ParameterMessageReceiver param = new ParameterMessageReceiver(
                    Environment.GetEnvironmentVariable("AccessKey"), 
                    Environment.GetEnvironmentVariable("SecretKey"), 
                    SQS_URL, Amazon.RegionEndpoint.USEast2);

CustomMessageReceiver messageReceiver = new CustomMessageReceiver();


amazonConnection.Notification.StartReceivingNotificationMessages(param, messageReceiver);
public class CustomMessageReceiver : IMessageReceiver
{
     public void ErrorCatch(Exception ex)
     {
         //Your code here
     }

     public void NewMessageRevicedTriger(NotificationMessageResponce message)
     {
         //Your Code here
     }
}

Feed Submit

Here full sample for submit feed to change price and generate XML and get final report for result same as in doc. Notes: not all feed type finished as it's big work and effort but all classes are partial for easy change and you can generate XML outside and use our library to get data, now we support only submit existing product, change quantity and change price , I list most of XSD here Source\FikaAmazonAPI\ConstructFeed\xsd its will help you easy generate class and add it in your app to generate final feed xml.

ConstructFeedService createDocument = new ConstructFeedService("{SellerID}", "1.02");

var list = new List<PriceMessage>();
list.Add(new PriceMessage()
{
    SKU = "8201031206122...",
    StandardPrice = new StandardPrice()
    {
        currency = BaseCurrencyCode.AED.ToString(),
        Value = (201.0522M).ToString("0.00")
    }
});
createDocument.AddPriceMessage(list);

var xml = createDocument.GetXML();

var feedID = amazonConnection.Feed.SubmitFeed(xml, FeedType.POST_PRODUCT_PRICING_DATA);

Thread.Sleep(1000*30);

var feedOutput=amazonConnection.Feed.GetFeed(feedID);

var outPut=amazonConnection.Feed.GetFeedDocument(feedOutput.ResultFeedDocumentId);

var reportOutpit = outPut.Url;

var processingReport = amazonConnection.Feed.GetFeedDocumentProcessingReport(outPut.Url);


Usage Plans and Rate Limits in the Selling Partner API

Please read this doc to get all information about this limitation https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/usage-plans-rate-limits/Usage-Plans-and-Rate-Limits.md

we calc waiting time by read x-amzn-RateLimit-Limit header

int sleepTime = (int)(1 / header["x-amzn-RateLimit-Limit"]*1000);

You can also disable libary from handelling limitaion by set IsActiveLimitRate=false in AmazonCredential

var amazonConnection = new AmazonConnection(new AmazonCredential()
{
      .
      .
      IsActiveLimitRate=false
});

Q & A

If you have questions, please ask in GitHub discussions

discussions


ToDo

  • Improve documentation

Notes

If you are looking for a complete Feedback solution, you might want to consider giving Soon.se a shot.


Support & Consultation

We offer consultation on everything SP-API related. Book your meeting here:

Book Meeting


Thanks

Thanks go out to everybody who worked on this package.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CSharpAmazonSpAPI:

Package Downloads
NoonConnector

Package Description

BizDoc.Infrastructure.Amazon

Amazon for BizDoc

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.9.17 230 10/27/2025
1.9.16 139 10/24/2025
1.9.15 171 10/23/2025
1.9.14 159 10/23/2025
1.9.13 451 10/8/2025
1.9.11 2,343 8/31/2025
1.9.10 1,692 8/5/2025
1.9.9 272 8/5/2025
1.9.8 699 7/17/2025
1.9.7 193 7/17/2025
1.9.6 313 7/15/2025
1.9.5 191 7/15/2025
1.9.4 316 7/4/2025
1.9.3 190 7/4/2025
1.9.2 265 7/1/2025
1.9.1 207 7/1/2025
1.8.9 4,535 4/22/2025
1.8.8 286 4/22/2025
1.8.7 231 4/22/2025
1.8.6 827 4/10/2025
1.8.5 245 4/10/2025
1.8.3 239 4/10/2025
1.8.1 9,501 1/21/2025
1.7.34 2,326 12/26/2024
1.7.33 1,134 12/16/2024
1.7.32 2,379 12/5/2024
1.7.31 5,086 11/15/2024
1.7.30 3,790 11/4/2024
1.7.29 913 10/18/2024
1.7.28 1,055 10/4/2024
1.7.27 1,877 9/25/2024
1.7.26 390 9/23/2024
1.7.24 1,075 9/11/2024
1.7.23 436 9/6/2024
1.7.22 3,903 7/13/2024
1.7.21 279 7/10/2024
1.7.20 211 7/10/2024
1.7.19 221 7/10/2024
1.7.18 14,563 4/22/2024
1.7.17 4,226 3/11/2024
1.7.16 242 3/10/2024
1.7.15 376 3/6/2024
1.7.14 717 3/3/2024
1.7.13 4,355 2/1/2024
1.7.12 498 1/29/2024
1.7.11 1,176 1/16/2024
1.7.10 1,959 12/30/2023
1.7.9 1,364 12/11/2023
1.7.8 12,144 10/26/2023
1.7.7 424 10/24/2023
1.7.5 1,209 10/13/2023
1.7.4 677 10/8/2023
1.7.3 1,168 9/21/2023
1.7.2 1,006 8/30/2023
1.7.1 3,663 8/9/2023
1.6.11 10,789 7/3/2023
1.6.9 499 7/3/2023
1.6.8 1,705 6/24/2023
1.6.7 1,013 6/17/2023
1.6.6 4,740 5/18/2023
1.6.5 1,966 5/7/2023
1.6.4 4,835 4/20/2023
1.6.3 438 4/18/2023
1.6.2 10,018 3/24/2023
1.6.1 648 3/18/2023
1.6.0 854 3/18/2023
1.5.35 1,051 3/14/2023
1.5.34 373 3/14/2023
1.5.33 2,278 2/10/2023
1.5.32 1,920 1/24/2023
1.5.31 1,001 1/11/2023
1.5.30 2,037 1/3/2023
1.5.29 478 12/28/2022
1.5.28 544 12/23/2022
1.5.27 716 12/18/2022
1.5.26 1,141 12/13/2022
1.5.25 3,470 12/11/2022
1.5.24 678 12/2/2022
1.5.23 500 12/1/2022
1.5.22 498 12/1/2022
1.5.21 1,037 11/27/2022
1.5.20 473 11/26/2022
1.5.19 758 11/23/2022
1.5.18 696 11/22/2022
1.5.17 473 11/21/2022
1.5.16 505 11/17/2022
1.5.15 802 11/16/2022
1.5.14 487 11/16/2022
1.5.13 458 11/16/2022
1.5.12 961 11/7/2022
1.5.11 518 11/7/2022
1.5.10 550 11/6/2022
1.5.9 557 11/6/2022
1.5.8 529 11/3/2022
1.5.7 574 11/2/2022
1.5.6 580 11/1/2022
1.5.5 2,145 10/24/2022
1.5.4 535 10/24/2022
1.5.3 674 10/23/2022
1.5.2 1,112 10/19/2022
1.5.1 627 10/18/2022
1.5.0 1,144 10/18/2022
1.5.0-alpha1 246 10/7/2022
1.4.32 7,366 10/6/2022
1.4.31 714 10/5/2022
1.4.30 2,357 9/22/2022
1.4.29 638 9/22/2022
1.4.28 844 9/17/2022
1.4.27 660 9/12/2022
1.4.26 752 9/6/2022
1.4.25 618 9/4/2022
1.4.24 602 9/2/2022
1.4.23 1,331 8/18/2022
1.4.22 1,757 8/16/2022
1.4.21 665 8/15/2022
1.4.20 3,916 8/14/2022
1.4.19 2,577 8/12/2022
1.4.18 627 8/11/2022
1.4.17 7,126 8/8/2022
1.4.16 611 8/8/2022
1.4.15 698 8/5/2022
1.4.14 925 8/4/2022
1.4.13 844 7/29/2022
1.4.12 609 7/29/2022
1.4.11 650 7/29/2022
1.4.10 695 7/27/2022
1.4.9 618 7/27/2022
1.4.8 948 7/27/2022
1.4.7 831 7/26/2022
1.4.6 743 7/24/2022
1.4.5 805 7/18/2022
1.4.4 742 7/14/2022
1.4.3 2,132 7/13/2022
1.4.2 677 7/11/2022
1.4.1 2,579 7/3/2022
1.4.0 632 6/30/2022
1.3.21 634 6/30/2022
1.3.20 665 6/29/2022
1.3.19 642 6/28/2022
1.3.18 643 6/27/2022
1.3.17 592 6/27/2022
1.3.16 3,682 6/14/2022
1.3.15 640 6/14/2022
1.3.14 815 6/11/2022
1.3.13 1,439 6/3/2022
1.3.12 676 5/31/2022
1.3.11 633 5/28/2022
1.3.10 1,801 5/19/2022
1.3.9 896 5/14/2022
1.3.8 710 5/10/2022
1.3.7 616 5/10/2022
1.3.5 1,300 5/5/2022
1.3.4 664 5/2/2022
1.3.3 926 4/29/2022
1.3.2 822 4/15/2022
1.3.1 621 4/15/2022
1.3.0 3,705 3/17/2022
1.2.10 1,098 3/16/2022
1.2.9 977 3/12/2022
1.2.8 638 3/12/2022
1.2.7 1,754 3/10/2022
1.2.6 964 3/7/2022
1.2.5 669 3/5/2022
1.2.4 658 3/4/2022
1.2.3 689 3/4/2022
1.2.2 664 3/2/2022
1.2.1 686 3/1/2022
1.2.0 657 2/26/2022
1.1.5 748 2/20/2022
1.1.4 633 2/18/2022
1.1.3 640 2/18/2022
1.1.2 907 2/17/2022
1.1.0 799 2/14/2022
1.1.0-beta 310 2/14/2022
1.1.0-alpha.5 227 2/12/2022
1.1.0-alpha.4 246 2/12/2022
1.1.0-alpha.3 225 2/12/2022
1.1.0-alpha.2 228 2/12/2022
1.1.0-alpha.1 247 2/12/2022
1.0.45.3-alpha 312 2/12/2022
1.0.45.2-alpha 340 2/12/2022
1.0.45.1-alpha 300 2/12/2022
1.0.45-alpha.4 243 2/12/2022
1.0.45-alpha 315 2/12/2022
1.0.44 814 2/9/2022
1.0.43 641 2/2/2022
1.0.42 652 1/27/2022
1.0.41 638 1/22/2022
1.0.40 627 1/22/2022
1.0.39 587 1/22/2022
1.0.38 641 1/20/2022
1.0.37 796 1/17/2022
1.0.36 661 1/16/2022
1.0.35 649 1/15/2022
1.0.34 644 1/12/2022
1.0.33 651 1/11/2022
1.0.32 508 1/10/2022
1.0.31 586 1/9/2022
1.0.30 464 1/9/2022
1.0.29 492 1/6/2022
1.0.28 522 1/5/2022
1.0.27 463 1/4/2022
1.0.26 454 1/4/2022
1.0.25 477 1/1/2022
1.0.24 827 12/31/2021
1.0.23 466 12/31/2021
1.0.22 523 12/23/2021
1.0.21 495 12/21/2021
1.0.20 495 12/18/2021
1.0.18 536 12/6/2021
1.0.17 3,112 11/25/2021
1.0.16 519 11/23/2021
1.0.15 478 11/23/2021
1.0.14 1,741 11/19/2021
1.0.13 719 10/23/2021
1.0.12 523 10/14/2021
1.0.11 535 10/11/2021
1.0.10 595 10/3/2021
1.0.9 949 9/25/2021 1.0.9 is deprecated because it is no longer maintained.
1.0.8 867 9/25/2021 1.0.8 is deprecated because it is no longer maintained.
1.0.7 710 9/25/2021 1.0.7 is deprecated because it is no longer maintained.
1.0.6 650 9/24/2021 1.0.6 is deprecated because it is no longer maintained.
1.0.5 744 9/20/2021 1.0.5 is deprecated because it is no longer maintained.
1.0.4 705 9/18/2021 1.0.4 is deprecated because it is no longer maintained.
1.0.3 641 9/18/2021 1.0.3 is deprecated because it is no longer maintained.
1.0.2 708 9/17/2021 1.0.2 is deprecated because it is no longer maintained.
1.0.1 747 9/2/2021 1.0.1 is deprecated because it is no longer maintained and has critical bugs.
1.0.0 787 8/17/2021 1.0.0 is deprecated because it is no longer maintained and has critical bugs.