我制作了一个使用亚马逊产品广告 API 的 VBA 程序。通常它运行良好,但是当请求 url 包含!
或(
API 返回错误代码时SignatureDoesNotMatch
。但是,我的程序发送的签名和 URL 与http://associates-amazon.s3.amazonaws.com/signed-requests/helper/index.html生成的完全一样(所以生成的 url 也会出错) .
该错误是由(, ), *, !
和引起的'
。
@ / [ ] { } + - = . , : ; \ | _ ? " # $ % & ^ ~ `
不。(似乎他们只是被忽略了。)
从参数中删除这些字符是一种解决方案。但如果有人知道问题的原因和/或更好的解决方案,请告诉我。
程序在这里。入口点是“main.searchBookInfo”,“helper.getSignature”生成签名。
例子:
未签名网址:
http://ecs.amazonaws.jp/onca/xml?AWSAccessKeyId=AKIAIL7NZCKP32A32LQQ&AssociateTag=attentiveada-20&Author=&Operation=ItemSearch&Publisher=&ResponseGroup=ItemAttributes&SearchIndex=Books&Service=AWSECommerceService&Timestamp=2011-12-03T20%3A26%3A16%2B02010&Title=!& -08-01
要签名的字符串:
得到 ecs.amazonaws.jp /onca/xml AWSAccessKeyId=AKIAIL7NZCKP32A32LQQ&AssociateTag=attentiveada-20&Author=&Operation=ItemSearch&Publisher=&ResponseGroup=ItemAttributes&SearchIndex=Books&Service=AWSECommerceService&Timestamp=2011-12-03T20%3A26%3A16%2B0900&Title=!&Version=2011-08-01
签名:
fmQKEfrtYkdWoJNHUryWIPoybM%2FqzOdFFmlgrQkBS2E%3D