<div dir="ltr">They give you examples in the documentation, rather than worrying about what that RFC means you can just try crypto:hmac/3 and see if it works (hint: it does).<div><br></div><div><div>1> base64:encode(crypto:hmac(sha256, <<"1234567890">>, <<"GET\<a href="http://nwebservices.amazon.com">nwebservices.amazon.com</a>\n/onca/xml\nAWSAccessKeyId=AKIAIOSFODNN7EXAMPLE&AssociateTag=mytag-20&ItemId=0679722769&Operation=ItemLookup&ResponseGroup=Images%2CItemAttributes%2COffers%2CReviews&Service=AWSECommerceService&Timestamp=2014-08-18T12%3A00%3A00Z&Version=2013-08-01">>)).</div><div><<"j7bZM0LXZ9eXeZruTqWm2DIvDYVUU3wxPPpp+iXxzQc=">></div></div><div><br></div><div>This matches their example:</div><div>j7bZM0LXZ9eXeZruTqWm2DIvDYVUU3wxPPpp+iXxzQc= <br></div><div><br></div><div>-bob</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 9, 2015 at 12:22 PM, <span dir="ltr"><<a href="mailto:lloyd@writersglen.com" target="_blank">lloyd@writersglen.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ayo,<br>
<br>
Looks cool. I'll give it spin. Thanks.<br>
<br>
Meanwhile, taking Darach Ennis suggestion to use the Library of Commerce db, I came up with this:<br>
<br>
<a href="https://gist.github.com/anonymous/dd9846ef1cb2826f59da" target="_blank">https://gist.github.com/anonymous/dd9846ef1cb2826f59da</a><br>
<br>
Bob Ippolito, I did put effort into trying to build it-- put half a day into it and got 98% of the way there before I got stuck. Why stuck? I simply could not understand the rather cryptic crypto documentation sufficiently to "Calculate an RFC 2104-compliant HMAC with the SHA256 hash algorithm". This could speak to my mental shortcomings, lack of experience, or heavens, could it be that the documentation could use elaboration and better examples? I appreciate your encouragement to work it out and I try. But code is just that, code, unless you have the keys to the kingdom. Nevertheless, I appreciate your response.<br>
<br>
Best to all,<br>
<br>
Lloyd<br>
<div class="HOEnZb"><div class="h5"><br>
-----Original Message-----<br>
From: "ayodele abejide" <<a href="mailto:abejideayodele@gmail.com">abejideayodele@gmail.com</a>><br>
Sent: Thursday, April 9, 2015 2:20pm<br>
To: "Bob Ippolito" <<a href="mailto:bob@redivi.com">bob@redivi.com</a>><br>
Cc: "Lloyd Prentice" <<a href="mailto:lloyd@writersglen.com">lloyd@writersglen.com</a>>, "Erlang Questions" <<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>><br>
Subject: Re: [erlang-questions] Amazon API -- Lookup by ISBN<br>
<br>
I played around with implementing this:<br>
<br>
<a href="https://gist.github.com/bjhaid/5d3c58aca0dbee0d96fd" target="_blank">https://gist.github.com/bjhaid/5d3c58aca0dbee0d96fd</a><br>
<br>
PS: It's not tested outside of erl, and was a lunch time hacking.<br>
<br>
BR,<br>
<br>
Ayo<br>
<br>
<br>
On Thu, Apr 9, 2015 at 12:44 PM, Bob Ippolito <<a href="mailto:bob@redivi.com">bob@redivi.com</a>> wrote:<br>
<br>
> I'm sure they're just trying to keep tabs on who uses the API so that they<br>
> can implement rate limiting and such to prevent third parties from scraping<br>
> the entire database or adversely affecting performance for everyone else.<br>
> This actually looks like one of the simpler APIs to implement, since it's<br>
> just in the query string, and the signature is using standard algorithms.<br>
> I'm sure you could get it if you put some effort into just building it<br>
> rather than trying to find an implementation that someone else has already<br>
> built.<br>
><br>
> On Thu, Apr 9, 2015 at 9:55 AM, <<a href="mailto:lloyd@writersglen.com">lloyd@writersglen.com</a>> wrote:<br>
><br>
>> Thanks all.<br>
>><br>
>> Darach--- looks like the Library of Congress API fits the bill.<br>
>><br>
>> Garrett--- for sake of self-enlightenment I'll take a look at Python<br>
>> implementations.<br>
>><br>
>> I can understand that Amazon needs to enforce security on their api, but<br>
>> one would think that the inventor of one-click ordering could come up with<br>
>> a simpler api request implementation. Maybe they're just trying to keep<br>
>> pesky users like me out of the goodies. Wizards only apply.<br>
>><br>
>> Best wishes,<br>
>><br>
>> Lloyd<br>
>><br>
>><br>
>><br>
>> -----Original Message-----<br>
>> From: "Darach Ennis" <<a href="mailto:darach@gmail.com">darach@gmail.com</a>><br>
>> Sent: Wednesday, April 8, 2015 8:07pm<br>
>> To: "Lloyd Prentice" <<a href="mailto:lloyd@writersglen.com">lloyd@writersglen.com</a>><br>
>> Cc: "Erlang Questions" <<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>><br>
>> Subject: Re: [erlang-questions] Amazon API -- Lookup by ISBN<br>
>><br>
>> If you don't need the rank information you can get the metadata through<br>
>> composing a URL<br>
>> against the library of congress database:<br>
>><br>
>><br>
>> <a href="http://lx2.loc.gov:210/lcdb?version=1.1&operation=searchRetrieve&query=bath.isbn=0448421658&maximumRecords=1&recordSchema=mods" target="_blank">http://lx2.loc.gov:210/lcdb?version=1.1&operation=searchRetrieve&query=bath.isbn=0448421658&maximumRecords=1&recordSchema=mods</a><br>
>><br>
>> This will deliver an XML document. You can get similar information from<br>
>> Google's API:<br>
>><br>
>> <a href="http://www.google.com/books/feeds/volumes/?q=ISBN%3C0448421658%3E" target="_blank">http://www.google.com/books/feeds/volumes/?q=ISBN%3C0448421658%3E</a><br>
>><br>
>> Both are simple HTTP GET requests so unless you absolutely need data<br>
>> unique<br>
>> to Amazon's DB perhaps that would suffice.<br>
>><br>
>> Cheers,<br>
>><br>
>> Darach.<br>
>><br>
>> On Wed, Apr 8, 2015 at 9:47 PM, <<a href="mailto:lloyd@writersglen.com">lloyd@writersglen.com</a>> wrote:<br>
>><br>
>> > Hello,<br>
>> ><br>
>> > I'm striving to look up books in Amazon's db by ISBN. At first blush it<br>
>> > looks easy enough:<br>
>> ><br>
>> ><br>
>> ><br>
>> <a href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/EX_LookupbyISBN.html" target="_blank">http://docs.aws.amazon.com/AWSECommerceService/latest/DG/EX_LookupbyISBN.html</a><br>
>> ><br>
>> > But the last item, Signature, baffles me. Procedure here:<br>
>> ><br>
>> ><br>
>> ><br>
>> <a href="http://docs.aws.amazon.com/AWSECommerceService/latest/DG/rest-signature.html" target="_blank">http://docs.aws.amazon.com/AWSECommerceService/latest/DG/rest-signature.html</a><br>
>> ><br>
>> > I'm fine with this until I hit step 4:<br>
>> ><br>
>> > -- Sort parameter/value pairs by byte value --- I can see how to do this<br>
>> > manually, but don't know how put Erlang to the task<br>
>> ><br>
>> > And I'm really stumped when I hit step 8:<br>
>> ><br>
>> > -- Calculate an RFC 2104-compliant HMAC with the SHA256 hash algorithm<br>
>> ><br>
>> > Any help? Better yet, does anyone have actual code to make such requests<br>
>> > they're willing to share?<br>
>> ><br>
>> > NOTE: Dave Thomas solved this problem way back in 2007. But looks like<br>
>> > Amazon has changed their request format:<br>
>> ><br>
>> > <a href="http://pragdave.me/blog/2007/04/15/a-first-erlang-program/" target="_blank">http://pragdave.me/blog/2007/04/15/a-first-erlang-program/</a><br>
>> ><br>
>> > Many thanks,<br>
>> ><br>
>> > LRP<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > erlang-questions mailing list<br>
>> > <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>> > <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>> ><br>
>><br>
>><br>
>> _______________________________________________<br>
>> erlang-questions mailing list<br>
>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
>> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
>><br>
><br>
><br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
><br>
<br>
<br>
</div></div></blockquote></div><br></div>