Tag Archives: amazon

Just a couple of weeks ago I bought Seth Godin’s latest book “Poke The Box” for my Kindle.  It’s a really short book and took just an hour or two to get through but it was a great motivator.  Definitely the kind of book that I could read once or twice a year as a reminder to keep on getting stuff started.

The main premise of the book is that to be successful as an entrepreneur, or in any job really, is to continually just do stuff.  Get things started, put ideas out there and take the risks of failure head on.

I think though the big take away for me was the reframing of the word “start”.  The way Seth Godin puts it you haven’t really started anything until you have made it available in the market place for sale.  Until what you have built is available for people to buy what you have is just a hobby.

Once you do have something available in the marketplace is really when you can start with everything that really matters in business.  You can start testing things:

  • offers
  • price points
  • copywriting

Until you have started selling what you have, you really haven’t started anything.

The other big idea that Seth talks about in the book is the nature of most big business to become a factory like machine with little freedom to find better ways to do things, or to find and develop new areas for the business to be in.  Many businesses out there keep their employees restricted to doing their job and nothing more than what is asked of them.  Anything that may shake things up is discouraged.  Businesses that follow this pattern are doomed to be second-tier to the ones that are continually taking risks and developing fresh ideas.

Anyway it was a great read and I recommend checking it out on amazon.com.

Poke the Box By Seth Godin (amazon aff. link)

Product Advertising APIThe Amazon Product Advertising API allows you to to do a lot of stuff. Using their REST interface you can browse the entire catalogue of Amazon products, get the prices pictures, descriptions and reviews for just about everything. It’s also possible to use Amazon’s shopping cart. Using this API it is possible to create you’re own e-commerse website with none of your own inventory, and without having to deal with credit card payments or the hassles that most e-commerse stores deal with.

It would be interesting to come up with you’re own value-add to the Amazon experience and offer that through your own website. Just off the top of my head that might be something like

  • a Digg like site for products where people thumb up things like like
  • A more stream lined webpage for looking at reviews
  • A niche website that finds and sells just a small subset of the products
  • A College specific site with links to the books used for each course

There are a lot of possibilities but to get started you need to understand how Amazon organizes and presents this information.

Once you sign up as an Amazon Associate and get the keys you need to access the service you can build the request URL that will return some XML with the information you asked for or any error messages.

Each REST request will require an Operation argument. Each operation has a number of required and optional arguments. For example the “Operation=ItemSearch” will return the items that match the search criteria. The type of information you get back is determined by the ResponseGroup required argument. You can get back just the images for a product by requesting ResponseGroup=Image, or get the editorial review by requesting ResponseGroup=EditorialReview. There are some product specific response groups such as Tracks that are valid for music albums.

When trying to dig through the available products you need to use Amazons own hierarcy of product categories to find what you want. These are called BrowseNodes. A BrowseNode is identified with a positive integer and given a name. They are created and deleted from the system regularly so you shouldn’t save them in your programs. BrowseNodes are hierarchical so the root node “Books” has many child nodes such as “Mystery” and “Non-Fiction” and those in turn have more children. As you can imagine a product may belong to multiple BrowseNodes and a BrowseNode can have multiple parent nodes.

The SearchIndex is the high level category for a product. This is a fixed list that includes: Books, DVD, Apparel, Music, and Software. By separating a search into a SearchIndex it allows Amazon to better optimize how they query their large catalog of available products. And it will return more relevant results for a search query.

So a REST request to the the Product Advertising API might look something like:

http://ecs.amazonaws.com/onca/xml?
Service=AWSECommerceService&
Operation=ItemSearch&
AWSAccessKeyId=[Access Key ID]&
AssociateTag=[ID]&
SearchIndex=Apparel&
Keywords=Shirt

This will return an XML document that contains a list of Shirts that are available as sell as information about each shirt. Because the SeachIndex is Apparel it will not return any books about Shirts.

You’ll need to reference the API documentation if you want to write anything using this. Be prepared.. the documentation is 600 pages long. It’s available here.

I hope this post gives you an idea about where to start with using Amazons Product Advertising API. I have written a few python scripts now that use it and will be cleaning them up this week to post here so stay tuned for that.

Product Advertising APIAmazon has a very comprehensive associate program that allows you to promote just about anything imaginable for any niche and earn commission for anything you refer. The size of the catalog is what makes Amazon such a great program. People make some good money promoting Amazon products.

There is a great Python library out there for accessing the other Amazon web services such as S3, and EC2 called boto. However it doesn’t support the Product Advertising API.

With the Product Advertising API you have access to everything that you can read on the Amazon site about each product. This includes the product description, images, editor reviews, customer reviews and ratings. This is a lot of great information that you could easily find a good use for with your websites.

So how do you get at this information from within a Python program? Well the complicated part is dealing with the authentication that Amazon has put in place. To make that a bit easier I used the connection component from boto.

Here’s a demonstration snippet of code that will print out the top 10 best selling books on Amazon right now.

Example Usage:

$ python AmazonSample.py
Glenn Becks Common Sense: The Case Against an Out-of-Control Government, Inspired by Thomas Paine by Glenn Beck
Culture of Corruption: Obama and His Team of Tax Cheats, Crooks, and Cronies by Michelle Malkin
The Angel Experiment (Maximum Ride, Book 1) by James Patterson
The Time Travelers Wife by Audrey Niffenegger
The Help by Kathryn Stockett
South of Broad by Pat Conroy
Paranoia by Joseph Finder
The Girl Who Played with Fire by Stieg Larsson
The Shack [With Headphones] (Playaway Adult Nonfiction) by William P. Young
The Girl with the Dragon Tattoo by Stieg Larsson

To use this code you’ll need an Amazon associate account and fill out the keys and tag needed for authentication.

Product Advertising API Python code:

#!/usr/bin/env python
# encoding: utf-8
"""
AmazonExample.py
 
Created by Matt Warren on 2009-08-17.
Copyright (c) 2009 HalOtis.com. All rights reserved.
"""
 
import urllib
try:
    from xml.etree import ET
except ImportError:
    from elementtree import ET
 
from boto.connection import AWSQueryConnection
 
AWS_ACCESS_KEY_ID = 'YOUR ACCESS KEY'
AWS_ASSOCIATE_TAG = 'YOUR TAG'
AWS_SECRET_ACCESS_KEY = 'YOUR SECRET KEY'
 
def amazon_top_for_category(browseNodeId):
    aws_conn = AWSQueryConnection(
        aws_access_key_id=AWS_ACCESS_KEY_ID,
        aws_secret_access_key=AWS_SECRET_ACCESS_KEY, is_secure=False,
        host='ecs.amazonaws.com')
    aws_conn.SignatureVersion = '2'
    params = dict(
        Service='AWSECommerceService',
        Version='2009-07-01',
        SignatureVersion=aws_conn.SignatureVersion,
        AWSAccessKeyId=AWS_ACCESS_KEY_ID,
        AssociateTag=AWS_ASSOCIATE_TAG,
        Operation='ItemSearch',
        BrowseNode=browseNodeId,
        SearchIndex='Books',
        ResponseGroup='ItemAttributes,EditorialReview',
        Order='salesrank',
        Timestamp=time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime()))
    verb = 'GET'
    path = '/onca/xml'
    qs, signature = aws_conn.get_signature(params, verb, path)
    qs = path + '?' + qs + '&Signature=' + urllib.quote(signature)
    response = aws_conn._mexe(verb, qs, None, headers={})
    tree = ET.fromstring(response.read())
 
    NS = tree.tag.split('}')[0][1:]
 
    for item in tree.find('{%s}Items'%NS).findall('{%s}Item'%NS):
        title = item.find('{%s}ItemAttributes'%NS).find('{%s}Title'%NS).text
        author = item.find('{%s}ItemAttributes'%NS).find('{%s}Author'%NS).text
        print title, 'by', author
 
if __name__ == '__main__':
    amazon_top_for_category(1000) #Amazon category number for US Books