After researching a few items on Amazon recently, and scouring through hundreds of customer questions, I thought it might be nice to find a way to extract a product's question and answer section for easy viewing all at once. After all, there's usually good info about a product buried in there, but the format for reading it stinks.

Amazon's got a lot of APIs, but I think the one I want is the Amazon Product Advertising API. The documentation is hit or miss, and some links are dead, but it seems to still be limping along. Before we dig deeper though, two things to consider:

  • If you're new to APIs, check out "What do we mean by API?" to learn more.
  • You also may want to install Postman, which lets you access API endpoints without having to write an app, plus you can save/sync everything to the cloud.

What's it do?

So what's this particular API do? Well, it's supposed to allow you to query the Amazon catalog, either with keywords or by targeting specific products, and extract details about those products in order to promote (advertise) them. I'm hoping that the question/answer area is one of those details that can be extracted, but we'll see.

Directly from the source:

You get access to a lot of the data used by Amazon including the items for sale, customer reviews, seller reviews, as well as most of the functionality you see on Amazon.com, such as finding items, displaying customer reviews, and product promotions. Product Advertising API operations open the doors to Amazon's databases so that you can take advantage of Amazon's sophisticated e-commerce data and functionality.

And what's it not do?

After reading a lot of the documentation, I eventually got to a section on "Best Programming Practices" where they make it pretty clear that repurposing this API in the way I'd like to is a no go joe. :p

The thrust of all Product Advertising API applications should be to direct sales to Amazon and thus earn Associate sales commissions. If your application is designed around another purpose, please reconsider and make sure your proposed Product Advertising API application falls within the guidelines of the Product Advertising API Terms and Conditions. Applications that do not meet the Product Advertising API Terms and Conditions will be blocked from accessing Product Advertising API.

How to Access

First, you need to signup to be an Amazon associate (aka affiliate). In the United States, this is the login page. Once you've signed up and been approved (yep, there's an approval process), you'll see a Store id in the upper-right - write that down somewhere. Maybe there's a way to get an "associate tag" without going through this process, but I doubt it.

Then you can visit the API page, login to your account, and click the big "Join" button to get a couple more pieces of information you'll need in order to use the API. Make note of the "access key" and "secret key" they generate for you - preferably somewhere secure! Once you refresh the page, the secret key is no longer visible. (learn more)

With these three pieces of info in hand....... now what? Seriously, Amazon has practically buried this API. Documentation and sample usages are often difficult to find, and some pages concerning this API just redirect to a generic landing page or show "page not found". It seems like the red-headed stepchild of Amazon's APIs. I don't get it.

Resources

Having said that and before we move on, here's a dump of all the links I dug up. It includes some archived versions of docs and code samples, and forks of deleted GitHub repos when that was all that was available.

Me, searching beyond the first page of Google. Hey, I was desperate.

Guides & Tools

Wrappers

Here's some API wrappers written for various languages / ecosystems:

Sample Code & Libraries

The Sample Code & Libraries are gone, but fortunately the Wayback Machine has a copy. Here are links to the samples it originally contained.

Signed Requests Sample Code

The Sample Code & Libraries section included links to code samples, which I attempted to track down even though most of them are pretty outdated by now. I uploaded these to GitHub to make them easier to find, since their Apache 2.0 license allows for redistribution.

Scratchpad

Now that that's out of the way, we can try a few things out. Amazon has a tool called Scratchpad, where you can do product searches without having to implement a whole solution in some language. Plus, it generates code snippets for your search, showing you how you might write your program once you've got the query you want. (learn more)

Click "ItemSearch" on the left, fill in your details on the top, and add a couple of values to search for. Here's a quick search, along with the results and code snippets showing how to make the request. It only shows a couple languages, but it should be enough to get a general idea for translating to other languages.

Parsing a URL

There's a button that says "Extract parameters from an Amazon URL", which lets you.. well... extract parameters. From an, uh, Amazon.. URL. So just enter a URL like this one for a Raspberry Pi kit, and it extracts the product id, etc, and then shows the result and code snippets like before. Whee.

Notice the value of the ResponseGroup - it defaults to "Large" for demo purposes, but there are lots of other documented values for response group too, which return specific pieces of data and thus produce much smaller responses.

In addition to the rendered response, you can check out the XML response too - it returns a ton of information about the product, which you can parse out however you need to.

Getting Customer Reviews

Some of the different "response group" options return fairly detailed results in the XML view. Others, like the "Reviews" response group, only return a URL which you can display in an iframe. That's.... less than helpful actually. If you just want 5 star reviews, there doesn't appear to be an easy way to do that.

<?xml version="1.0" ?>
<ItemLookupResponse
    xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
    <Items>
        <Request>
            <IsValid>True</IsValid>
            <ItemLookupRequest>
                <IdType>ASIN</IdType>
                <ItemId>B01CUMNIV8</ItemId>
                <ResponseGroup>Reviews</ResponseGroup>
                <VariationPage>All</VariationPage>
            </ItemLookupRequest>
        </Request>
        <Item>
            <ASIN>B01CUMNIV8</ASIN>
            <CustomerReviews>
                <IFrameURL>https://www.amazon.com/reviews/iframe?akid=AKIAJYTYBU4GMWNV4CFA&alinkCode=xm2&asin=B01CUMNIV8&atag=gwin04-20&exp=2018-10-09T12%3A26%3A22Z&v=2&sig=g5j7D4w61IQm826yKOjBM8GKTcJYvjIsg3N5KPyVtrI%253D</IFrameURL>
                <HasReviews>true</HasReviews>
            </CustomerReviews>
        </Item>
    </Items>
</ItemLookupResponse>

It'd be nice to be able to parse out individual reviews, but instead you just get a lump that only works for 24 hours and then visitors get a 403 error. Ugh.. why not a link leading to the latest reviews at least?

Anyway, maybe selecting specific reviews would be misleading anyway. I suppose you could display all your products as if they were awesome even if the overall reviews were terrible. I dunno.


Using in an Application

Unfortunately for my idea, after reviewing the documented response group values, it appears that the question/answer section isn't even an available section to request with this API. And even if it was, as I stated in the beginning this is an API for making money from directing sales to Amazon, so I probably shouldn't use it that way. Alas.

But you're still here, so we'll keep digging in. Here's a list of all available operations ... let's take it for a spin. We'll try querying for a list of products and then looking up a specific product's details. You can do more, but I'll leave that fun up to you.

API Wrappers

The easiest thing to do is build on what others have already one. No need to reinvent wheels... or in this case, figure out how to build a "signature" from scratch (more on that below).

.NET - Nager.AmazonProductAdvertising Library

If you're developing something in the .NET ecosystem, check out the NuGet package I mentioned earlier, Nager.AmazonProductAdvertising. Here's a fresh console app, with two new references added from the NuGet package.

His documentation is great too, with nice examples that just work! Here's an example showing an item search for Raspberry Pi products in Electronics: (available on GitHub too)

using Nager.AmazonProductAdvertising;
using Nager.AmazonProductAdvertising.Model;
using System;

namespace AmazonProductAdvertSig1
{
    class Program
    {
        static void Main(string[] args)
        {
            var authentication = new AmazonAuthentication
            {
                AccessKey = "your-access-key",
                SecretKey = "your-secret-key"
            };

            var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.US, "your-store-id");
            wrapper.ErrorReceived += (err) => Console.WriteLine($"Error {err.Error.Code}: {err.Error.Message}");
            wrapper.XmlReceived += (xml) => Console.WriteLine($"Received: {xml}");

            var result = wrapper.Search("raspberry pi", AmazonSearchIndex.Electronics, AmazonResponseGroup.Small);
            Console.WriteLine(result.Items.TotalResults);
            Console.ReadLine();
        }
    }
}

The author provides two events you can subscribe to - one for errors and one for whatever response you get back, and I subscribed to them both to show that I did indeed get expected results back. I set a breakpoint to show that it sent back a large XML response, and a total of the matching items (3595 results).

`

And here I am getting a specific item by its ID (also on GitHub) - in this case, it's a Vilros Raspberry Pi kit. The result set returns a lot more info, but I just printed out the item's URL here.

using Nager.AmazonProductAdvertising;
using Nager.AmazonProductAdvertising.Model;
using System;

namespace AmazonProductAdvertSig1
{
    class Program
    {
        static void Main(string[] args)
        {
            var authentication = new AmazonAuthentication
            {
                AccessKey = "your-access-key",
                SecretKey = "your-secret-key"
            };

            var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.US, "your-store-id");
            wrapper.ErrorReceived += (err) => Console.WriteLine($"Error {err.Error.Code}: {err.Error.Message}");
            wrapper.XmlReceived += (xml) => Console.WriteLine($"Received: {xml}");

            var result = wrapper.Lookup("B07BQFX4SB");
            Console.WriteLine(result.Items.Item[0].DetailPageURL);
            Console.ReadLine();
        }
    }
}
`

There's a lot more that his library can do, but I'll leave that up to you to play with. The fact that it works, and works well, makes it even weirder that Amazon has made this API so difficult to discover.

Incidentally, if you get an error back with a message like "Request has expired. Timestamp date is 2018-10-11T08:48:28Z." double-check the time on your system! I was running this on a system that didn't have the time/timezone set correctly, so it was several hours off, in which case the request will fail.

<?xml version="1.0"?>
<ItemSearchErrorResponse xmlns="http://ecs.amazonaws.com/doc/2009-03-31/">
  <Error>
    <Code>RequestExpired</Code>
    <Message>Request has expired. Timestamp date is 2018-10-11T08:48:28Z.</Message>
  </Error>
  <RequestID>c694c22b-c329-4438-b437-ae320bceae05</RequestID></ItemSearchErrorResponse>

Python - Bottlenose Library

There's another library, this one for Python, that appears to be alive and kicking too.  It has nice documentation, and clear examples that work well.

Here I'm getting Raspberry Pi products from the Electronics category again. (available on GitHub too)

import subprocess
import sys
import bottlenose

amazon = bottlenose.Amazon("your-access-key", "your-secret-key", "your-store-id")

response = amazon.ItemSearch(Keywords="Raspberry Pi", SearchIndex="Electronics")

print(response)

The response was pretty big, so this is a truncated version.

<?xml version="1.0" ?>
<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2013-08-01">
    <OperationRequest>
        <HTTPHeaders>
            <Header Name="UserAgent" Value="Python-urllib/3.7"></Header>
        </HTTPHeaders>
        <RequestId>ab43c8a2-554d-482f-84b6-73eb5b1356d3</RequestId>
        <Arguments>
            <Argument Name="AWSAccessKeyId" Value="AKIAJYTYBU4GMWNV4CFA"></Argument>
            <Argument Name="AssociateTag" Value="gwin04-20"></Argument>
            <Argument Name="Keywords" Value="Raspberry Pi"></Argument>
            <Argument Name="Operation" Value="ItemSearch"></Argument>
            <Argument Name="SearchIndex" Value="Electronics"></Argument>
            <Argument Name="Service" Value="AWSECommerceService"></Argument>
            <Argument Name="Timestamp" Value="2018-10-12T02:51:46Z"></Argument>
            <Argument Name="Version" Value="2013-08-01"></Argument>
            <Argument Name="Signature" Value="IoCucVURGAI8MDpofR1ZD9r+UzdyPJ3QMeSb22gPItI="></Argument>
        </Arguments>
        <RequestProcessingTime>0.0686039490000000</RequestProcessingTime>
    </OperationRequest>
    <Items>
        <Request>
            <IsValid>True</IsValid>
            <ItemSearchRequest>
                <Keywords>Raspberry Pi</Keywords>
                <ResponseGroup>Small</ResponseGroup>
                <SearchIndex>Electronics</SearchIndex>
            </ItemSearchRequest>
        </Request>
        <TotalResults>3606</TotalResults>
        <TotalPages>361</TotalPages>
        <MoreSearchResultsUrl>https://www.amazon.com/gp/search?linkCode=xm2&amp;SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;keywords=Raspberry%20Pi&amp;tag=gwin04-20&amp;creative=386001&amp;url=search-alias%3Delectronics&amp;camp=2025</MoreSearchResultsUrl>
        <Item>
            <ASIN>B07BC7BMHY</ASIN>
            <DetailPageURL>https://www.amazon.com/CanaKit-Raspberry-Premium-Clear-Supply/dp/B07BC7BMHY?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=165953&amp;creativeASIN=B07BC7BMHY</DetailPageURL>
            <ItemLinks>
                <ItemLink>
                    <Description>Technical Details</Description>
                    <URL>https://www.amazon.com/CanaKit-Raspberry-Premium-Clear-Supply/dp/tech-data/B07BC7BMHY?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BC7BMHY</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Add To Baby Registry</Description>
                    <URL>https://www.amazon.com/gp/registry/baby/add-item.html?asin.0=B07BC7BMHY&amp;SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BC7BMHY</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Add To Wedding Registry</Description>
                    <URL>https://www.amazon.com/gp/registry/wedding/add-item.html?asin.0=B07BC7BMHY&amp;SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BC7BMHY</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Add To Wishlist</Description>
                    <URL>https://www.amazon.com/gp/registry/wishlist/add-item.html?asin.0=B07BC7BMHY&amp;SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BC7BMHY</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Tell A Friend</Description>
                    <URL>https://www.amazon.com/gp/pdp/taf/B07BC7BMHY?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BC7BMHY</URL>
                </ItemLink>
                <ItemLink>
                    <Description>All Customer Reviews</Description>
                    <URL>https://www.amazon.com/review/product/B07BC7BMHY?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BC7BMHY</URL>
                </ItemLink>
                <ItemLink>
                    <Description>All Offers</Description>
                    <URL>https://www.amazon.com/gp/offer-listing/B07BC7BMHY?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BC7BMHY</URL>
                </ItemLink>
            </ItemLinks>
            <ItemAttributes>
                <Manufacturer>CanaKit</Manufacturer>
                <ProductGroup>PC Accessory</ProductGroup>
                <Title>CanaKit Raspberry Pi 3 B+ (B Plus) with Premium Clear Case and 2.5A Power Supply</Title>
            </ItemAttributes>
        </Item>
        <Item>
            <ASIN>B01CD5VC92</ASIN>
            <DetailPageURL>https://www.amazon.com/Raspberry-Pi-RASPBERRYPI3-MODB-1GB-Model-Motherboard/dp/B01CD5VC92?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=165953&amp;creativeASIN=B01CD5VC92</DetailPageURL>
            <ItemLinks>
                <ItemLink>
                    <Description>Technical Details</Description>
                    <URL>https://www.amazon.com/Raspberry-Pi-RASPBERRYPI3-MODB-1GB-Model-Motherboard/dp/tech-data/B01CD5VC92?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B01CD5VC92</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Add To Baby Registry</Description>
                    <URL>https://www.amazon.com/gp/registry/baby/add-item.html?asin.0=B01CD5VC92&amp;SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B01CD5VC92</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Add To Wedding Registry</Description>
                    <URL>https://www.amazon.com/gp/registry/wedding/add-item.html?asin.0=B01CD5VC92&amp;SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B01CD5VC92</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Add To Wishlist</Description>
                    <URL>https://www.amazon.com/gp/registry/wishlist/add-item.html?asin.0=B01CD5VC92&amp;SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B01CD5VC92</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Tell A Friend</Description>
                    <URL>https://www.amazon.com/gp/pdp/taf/B01CD5VC92?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B01CD5VC92</URL>
                </ItemLink>
                <ItemLink>
                    <Description>All Customer Reviews</Description>
                    <URL>https://www.amazon.com/review/product/B01CD5VC92?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B01CD5VC92</URL>
                </ItemLink>
                <ItemLink>
                    <Description>All Offers</Description>
                    <URL>https://www.amazon.com/gp/offer-listing/B01CD5VC92?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B01CD5VC92</URL>
                </ItemLink>
            </ItemLinks>
            <ItemAttributes>
                <Manufacturer>RASPBERRY PI</Manufacturer>
                <ProductGroup>Personal Computer</ProductGroup>
                <Title>Raspberry Pi 3 Model B Motherboard</Title>
            </ItemAttributes>
        </Item>
    </Items>
</ItemSearchResponse>

And here I'm getting a specific item (GitHub)... the same Vilros kit again. You could imagine a customer on your site selecting one of the items returned above, at which point you could look up and display extended information about a single item.

import subprocess
import sys
import bottlenose

amazon = bottlenose.Amazon("your-access-key", "your-secret-key", "your-store-id")

response = amazon.ItemLookup(ItemId="B07BQFX4SB")

print(response)
<?xml version="1.0" ?>
<ItemLookupResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2013-08-01">
    <OperationRequest>
        <HTTPHeaders>
            <Header Name="UserAgent" Value="Python-urllib/3.7"></Header>
        </HTTPHeaders>
        <RequestId>8324ff36-bd58-4c5f-91a0-ad4c87ff2162</RequestId>
        <Arguments>
            <Argument Name="AWSAccessKeyId" Value="AKIAJYTYBU4GMWNV4CFA"></Argument>
            <Argument Name="AssociateTag" Value="gwin04-20"></Argument>
            <Argument Name="ItemId" Value="B07BQFX4SB"></Argument>
            <Argument Name="Operation" Value="ItemLookup"></Argument>
            <Argument Name="Service" Value="AWSECommerceService"></Argument>
            <Argument Name="Timestamp" Value="2018-10-12T02:26:29Z"></Argument>
            <Argument Name="Version" Value="2013-08-01"></Argument>
            <Argument Name="Signature" Value="H1qPsncX7vH0YkPC5SqxkVzMj43P4WatETHQpwSFMYE="></Argument>
        </Arguments>
        <RequestProcessingTime>0.1387898430000000</RequestProcessingTime>
    </OperationRequest>
    <Items>
        <Request>
            <IsValid>True</IsValid>
            <ItemLookupRequest>
                <IdType>ASIN</IdType>
                <ItemId>B07BQFX4SB</ItemId>
                <ResponseGroup>Small</ResponseGroup>
                <VariationPage>All</VariationPage>
            </ItemLookupRequest>
        </Request>
        <Item>
            <ASIN>B07BQFX4SB</ASIN>
            <DetailPageURL>https://www.amazon.com/Vilros-Raspberry-Model-Supply-Latest/dp/B07BQFX4SB?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=165953&amp;creativeASIN=B07BQFX4SB</DetailPageURL>
            <ItemLinks>
                <ItemLink>
                    <Description>Technical Details</Description>
                    <URL>https://www.amazon.com/Vilros-Raspberry-Model-Supply-Latest/dp/tech-data/B07BQFX4SB?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BQFX4SB</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Add To Baby Registry</Description>
                    <URL>https://www.amazon.com/gp/registry/baby/add-item.html?asin.0=B07BQFX4SB&amp;SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BQFX4SB</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Add To Wedding Registry</Description>
                    <URL>https://www.amazon.com/gp/registry/wedding/add-item.html?asin.0=B07BQFX4SB&amp;SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BQFX4SB</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Add To Wishlist</Description>
                    <URL>https://www.amazon.com/gp/registry/wishlist/add-item.html?asin.0=B07BQFX4SB&amp;SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BQFX4SB</URL>
                </ItemLink>
                <ItemLink>
                    <Description>Tell A Friend</Description>
                    <URL>https://www.amazon.com/gp/pdp/taf/B07BQFX4SB?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BQFX4SB</URL>
                </ItemLink>
                <ItemLink>
                    <Description>All Customer Reviews</Description>
                    <URL>https://www.amazon.com/review/product/B07BQFX4SB?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BQFX4SB</URL>
                </ItemLink>
                <ItemLink>
                    <Description>All Offers</Description>
                    <URL>https://www.amazon.com/gp/offer-listing/B07BQFX4SB?SubscriptionId=AKIAJYTYBU4GMWNV4CFA&amp;tag=gwin04-20&amp;linkCode=xm2&amp;camp=2025&amp;creative=386001&amp;creativeASIN=B07BQFX4SB</URL>
                </ItemLink>
            </ItemLinks>
            <ItemAttributes>
                <Manufacturer>Vilros</Manufacturer>
                <ProductGroup>PC Accessory</ProductGroup>
                <Title>Vilros Raspberry Pi 3 Model B+ (B Plus)-with 2.5A Power Supply [Latest Model 2018]</Title>
            </ItemAttributes>
        </Item>
    </Items>
</ItemLookupResponse>

Oh, and if you get something like this, check to make sure your region code is correct (check the README to see what I'm talking about), and check the system time. If the region is wrong or your system time is incorrect, you'll get a 400 Bad Request.

  File "AmazonProductAdvert.py", line 7, in <module>
    response = amazon.ItemLookup(ItemId="B07BQFX4SB")
  File "C:\Python37\lib\site-packages\bottlenose\api.py", line 274, in __call__
    {'api_url': api_url, 'cache_url': cache_url})
  ...
  ...
  File "C:\Python37\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 400: Bad Request

Doing it from scratch

I've linked to quite a few existing projects and other libraries - use one of those if you can! If you need hints in Java or PHP, try building a request using the Product Advertising API Scratchpad. Here's another PHP tutorial that might get you started. And the signed request samples I mentioned earlier (GitHub) includes an example in Perl too, although I haven't checked it out. Otherwise, cross your fingers and hope there's a library out there for whatever language you're trying to work in. ;)

If all else fails, and you're forced to build something from scratch, the first thing you'll want to learn is how to generate a signature, something Amazon started requiring back in August 2009. I've seen this process in APIs before. It's typically a pain. The signed requests sample code can at least give us a clue.

I'm not even going to try creating a signature in some other language. It's complicated, and the implementation will depend on the language you choose. There are quite a few examples to go on, in addition to Amazon's documentation. And I've spent more evenings looking into this elusive API than I intended!

Final Thoughts

I realize at this point that I have little use for this, so my enthusiasm is waning. You can manipulate shopping carts too - here's a visual comparison of operations that might help if you're interested. I'll leave figuring that one out to you though!

If you decide to use this API, I'd be interested in hearing how it goes. Leave a comment below or hit me up on Twitter. Good luck!