http://www.perlmonks.org?node_id=934254


in reply to Re: Anyone Have Perl Code for New Amazon API?
in thread Anyone Have Perl Code for New Amazon API? [SOLVED]

:-) .. no, there are no iggerant answers in response to this question ... Anything that might help is appreciated!

Interesting, haven't checked it yet, but I'll wander over to that sourceforge link and see if there's some sample code worth hacking ...

  • Comment on Re^2: Anyone Have Perl Code for New Amazon API?

Replies are listed 'Best First'.
Re^3: Anyone Have Perl Code for New Amazon API?
by DanielSpaniel (Scribe) on Oct 27, 2011 at 23:05 UTC

    Solved. This was actually much easier than what I thought it was going to be ...

    For anyone else that seeks Perl/Amazon API wisdom, for the new API, then a couple of things:

    You can't just tack on the associates ID to the end of the request URL, because: firstly the params need to be in alphabetical order (yes, really ... so odd), but most importantly, it needs to be part of the request URL which gets "signed." That is, if you just tack it in the URL some place, without it being the portion of the URL which gets signed, then it won't work ... you'll get some signature error code back from Amazon.

    So, if you have the example code from the previous API, then find the code in there which looks a bit like the code below, and simply insert the AssociateTag line in there. I think that's the only required new param, although there are several other changes to the API. The version line might need to be changed as well, although right now it works with the old version date.

    my $request = { Service => 'AWSECommerceService', AssociateTag =>'xxxxxx', Operation => 'ItemSearch', BrowseNode=> $$node, Keywords =>"$$keywords", ItemPage =>"$$itempage", SearchIndex => $$searchindex, Version => '2009-03-31', ResponseGroup => $$response, };

    Thanks to all who responded! Appreciated.