Voora Tarun
Voora Tarun

Reputation: 1226

Product advertising API not working

I just joined as associate program in amazon product advertising api. I am able to run query in scratchpad but while in Coding it is giving error. Please give me any suggestion where I am getting wrong. I am using Node.JS for this.

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);
});

It is giving the following error :

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>

Upvotes: 1

Views: 437

Answers (1)

nicholasnet
nicholasnet

Reputation: 2287

As the error suggest you will need Amazon Associate account to access the API. The credentials that you are using seems invalid. You can test your credentials here Amazon Scratch pad

Upvotes: 3

Related Questions