Amazon Product Advertising API With ASP.NET MVC5 using C#

14 January 17 Ben Dickman

I recently wanted to use an API to get a list of Amazon products and came across a very useful nuget package called Nager.AmazonProductAdvertising. I found this package really simplified the process and I got products being returned in minimal time.

First of all you will need to grab yourself an access and secret key from Amazon. This is for the UK but I am sure you can find the site for your location easily enough.

Install the package using the followng command:

install-package Nager.AmazonProductAdvertising

Create the following Action in your Controller:

public ActionResult ItemSearch(string search)
        {
            var Auth = new AmazonAuthentication();
            
            Auth.AccessKey = "your_access_key";
            Auth.SecretKey = "your_secret_key";

            var Wrapper = new AmazonWrapper(Auth, AmazonEndpoint.UK);
            var SearchResult = Wrapper.Search(search);

            return View(SearchResult);
        }

In your View change the model to be:

@model Nager.AmazonProductAdvertising.Model.AmazonItemResponse

This object contains a list of products with a huge number of data points being provided for you to use as you wish. I have created a simple table to show the product Title and Price.

products table

This nuget package is a great way to simplify calls to the Amazon Product Advertising API, give it a try for youself.

See you next time, Ben