产品广告API无效

时间:2017-01-21 13:28:05

标签: node.js api amazon advertising

我刚加入亚马逊产品广告API的副项目。我能够在暂存器中运行查询,但在编码时它给出了错误。如果我出错了,请给我任何建议。我正在使用Node.JS。

const OperationHelper = require('apac').OperationHelper;

const opHelper = new OperationHelper({
    awsId:     '',
    awsSecret: '',
    assocId:   'tarun123-21'
});

opHelper.execute('ItemSearch', {
  'SearchIndex': 'Books',
  'Keywords': 'harry potter',
  'ResponseGroup': 'ItemAttributes,Offers',
   'Service' : 'AWSECommerceService'

}).then((response) => {
    console.log("Results object: ", response.result);
    console.log("Raw response body: ", response.responseBody);
}).catch((err) => {
    console.error("Something went wrong! ", err);
});

出现以下错误:

Results object:  { ItemSearchErrorResponse:
   { '$': { xmlns: 'http://ecs.amazonaws.com/doc/2013-08-01/' },
     Error:
      { Code: 'AWS.InvalidAssociate',
        Message: 'Your AKIAI7SZEKEZNMFWGJDQ is not registered as an Amazon Assoc
iate. Please register as an associate at https://affiliate-program.amazon.com/gp
/associates/join/landing/main.html.' },
     RequestId: 'e860887e-4bf7-4076-bfa9-6d2212324ba4' } }
Raw response body:  <?xml version="1.0"?>
<ItemSearchErrorResponse xmlns="http://ecs.amazonaws.com/doc/2013-08-01/"><Error
><Code>AWS.InvalidAssociate</Code><Message>Your AKIAI7SZEKEZNMFWGJDQ is not regi
stered as an Amazon Associate. Please register as an associate at https://affili
ate-program.amazon.com/gp/associates/join/landing/main.html.</Message></Error><R
equestId>e860887e-4bf7-4076-bfa9-6d2212324ba4</RequestId></ItemSearchErrorRespon
se>

1 个答案:

答案 0 :(得分:3)

由于错误提示您需要Amazon Associate帐户才能访问API。您使用的凭据似乎无效。您可以在此处Amazon Scratch pad

测试您的凭据