尝试使用Amazon Product Affiliate API时出错

时间:2014-03-05 16:10:37

标签: java rest amazon-web-services amazon

我正在尝试使用amazon产品附属API,这是一个非常令人困惑的体验。

我已注册AWS,因此我已ACCESS_KEY_IDSECRET_ACCESS_KEY我已注册https://affiliate-program.amazon.com/并已获得Tracking ID

现在尝试使用此网址发送请求时

http://ecs.amazonaws.com/onca/xml?
AWSAccessKeyId=AKIAI4E9BPWYGSC7VNZQ
&ItemId=0545010225
&Operation=ItemLookup
&ResponseGroup=Small
&Service=AWSECommerceService
&Timestamp=2014-03-05T15%3A55%3A46Z
&Version=2009-03-31
&Signature=mb6Stjz4I5GHV51bxVyACS4T%2FwGjplkVymW8eLDoh4Q%3D
&AssociateTag=sample026-20

我收到错误

<Error>
    <Code>SignatureDoesNotMatch</Code>
    <Message>The request signature we calculated does not match the signature you provided. 
     Check your AWS Secret Access Key and signing method. 
     Consult the service documentation for details.</Message>
</Error>

我提供了所需的所有参数,但不确定为什么信息不匹配。 如果我从网址中删除AssociateTag参数,则会收到此错误:

<Error>
   <Code>AWS.MissingParameters</Code>
   <Message>Your request is missing required parameters. Required parameters include AssociateTag.</Message>
</Error>

AssociateTag与我在注册amazon link后收到的Tracking ID有所不同

我正在尝试使用示例代码形式http://aws.amazon.com/code/Product-Advertising-API/2478来执行。除非那里有更好的选择....

1 个答案:

答案 0 :(得分:1)

它对我有用。签名可能有问题。 AssociateTag是您在注册联盟会员后获得的“联盟ID”,而不是任何跟踪ID。我签署了Amazon.co.uk Associates。

http://ecs.amazonaws.com/onca/xml?AWSAccessKeyId=AKIAIAAPUKLVP6OGAT4Q&AssociateTag=jay048-21&ItemId=0545010225&Operation=ItemLookup&ResponseGroup=Small&Service=AWSECommerceService&Timestamp=2014-03-05T17%3A14%3A31Z&Version=2009-03-31&Signature=Vfto8GdjP875KGwYrpe1QyfDkpUr3HDkQAyAcyyI4n0%3D

        <ItemLookupResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2011-08-01">
        <OperationRequest>
        <HTTPHeaders>
        <Header Name="UserAgent" Value="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36"/>
        </HTTPHeaders>
        <RequestId>5f5e44b1-8005-4b27-846a-9959775bdf24</RequestId>
        <Arguments>
        <Argument Name="Operation" Value="ItemLookup"/>
        <Argument Name="Service" Value="AWSECommerceService"/>
        <Argument Name="Signature" Value="Vfto8GdjP875KGwYrpe1QyfDkpUr3HDkQAyAcyyI4n0="/>
        <Argument Name="AssociateTag" Value="jay048-21"/>
        <Argument Name="Version" Value="2009-03-31"/>
        <Argument Name="ItemId" Value="0545010225"/>
        <Argument Name="AWSAccessKeyId" Value="AKIAIAAPUKLVP6OGAT4Q"/>
        <Argument Name="Timestamp" Value="2014-03-05T17:14:31Z"/>
        <Argument Name="ResponseGroup" Value="Small"/>
        </Arguments>
        <RequestProcessingTime>0.0143640000000000</RequestProcessingTime>
        </OperationRequest>
        <Items>
        <Request>
        <IsValid>True</IsValid>
        <ItemLookupRequest>
        <IdType>ASIN</IdType>
        <ItemId>0545010225</ItemId>
        <ResponseGroup>Small</ResponseGroup>
        <VariationPage>All</VariationPage>
        </ItemLookupRequest>
        </Request>
        <Item>
        <ASIN>0545010225</ASIN>
        <DetailPageURL>
        http://www.amazon.com/Harry-Potter-Deathly-Hallows-Book/dp/0545010225%3FSubscriptionId%3DAKIAIAAPUKLVP6OGAT4Q%26tag%3Djay048-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0545010225
        </DetailPageURL>
        <ItemLinks>
        <ItemLink>
        <Description>Technical Details</Description>
        <URL>
        http://www.amazon.com/Harry-Potter-Deathly-Hallows-Book/dp/tech-data/0545010225%3FSubscriptionId%3DAKIAIAAPUKLVP6OGAT4Q%26tag%3Djay048-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0545010225
        </URL>
        </ItemLink>
        <ItemLink>
        <Description>Add To Baby Registry</Description>
        <URL>
        http://www.amazon.com/gp/registry/baby/add-item.html%3Fasin.0%3D0545010225%26SubscriptionId%3DAKIAIAAPUKLVP6OGAT4Q%26tag%3Djay048-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0545010225
        </URL>
        </ItemLink>
        <ItemLink>
        <Description>Add To Wedding Registry</Description>
        <URL>
        http://www.amazon.com/gp/registry/wedding/add-item.html%3Fasin.0%3D0545010225%26SubscriptionId%3DAKIAIAAPUKLVP6OGAT4Q%26tag%3Djay048-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0545010225
        </URL>
        </ItemLink>
        <ItemLink>
        <Description>Add To Wishlist</Description>
        <URL>
        http://www.amazon.com/gp/registry/wishlist/add-item.html%3Fasin.0%3D0545010225%26SubscriptionId%3DAKIAIAAPUKLVP6OGAT4Q%26tag%3Djay048-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0545010225
        </URL>
        </ItemLink>
        <ItemLink>
        <Description>Tell A Friend</Description>
        <URL>
        http://www.amazon.com/gp/pdp/taf/0545010225%3FSubscriptionId%3DAKIAIAAPUKLVP6OGAT4Q%26tag%3Djay048-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0545010225
        </URL>
        </ItemLink>
        <ItemLink>
        <Description>All Customer Reviews</Description>
        <URL>
        http://www.amazon.com/review/product/0545010225%3FSubscriptionId%3DAKIAIAAPUKLVP6OGAT4Q%26tag%3Djay048-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0545010225
        </URL>
        </ItemLink>
        <ItemLink>
        <Description>All Offers</Description>
        <URL>
        http://www.amazon.com/gp/offer-listing/0545010225%3FSubscriptionId%3DAKIAIAAPUKLVP6OGAT4Q%26tag%3Djay048-21%26linkCode%3Dxm2%26camp%3D2025%26creative%3D386001%26creativeASIN%3D0545010225
        </URL>
        </ItemLink>
        </ItemLinks>
        <ItemAttributes>
        <Author>J. K. Rowling</Author>
        <Creator Role="Illustrator">Mary GrandPré</Creator>
        <Manufacturer>Arthur A. Levine Books</Manufacturer>
        <ProductGroup>Book</ProductGroup>
        <Title>Harry Potter and the Deathly Hallows (Book 7)</Title>
        </ItemAttributes>
        </Item>
        </Items>
        </ItemLookupResponse>