I'm working on an API Call using the npm wrapper amazon-paapi. I'm using Codepen.io, but whatever I do it gives back a bad response. This is the error I get on the console:
// [object Error]
{
"crossDomain": true,
"method": "POST",
"url": "https://webservices.amazon.it/paapi5/getitems"
}
The code I'm using is the following:
import amazonPaapi from "https://cdn.skypack.dev/amazon-paapi@1.0.6";
$("#bttn").on("click", function () {
const commonParameters = {
AccessKey: "AKXXXXXXXXX", //my PAAPI access key
SecretKey: "wiYYYYYYYYYYYYY", //my PAAPI secret key
PartnerTag: "zzz-21", //my tag
PartnerType: "Associates",
Marketplace: "www.amazon.it"
};
const requestParameters = {
ItemIds: ["B09P8LPYFT", "B01N06ZPKI"],
Resources: [
"Images.Primary.Large",
"ItemInfo.Title",
"Offers.Listings.Price"
]
};
amazonPaapi
.GetItems(commonParameters, requestParameters)
.then((data) => {
// do something with the success response.
console.log(data);
console.log("Success");
})
.catch((error) => {
// catch an error.
console.log(error);
console.log("Failure");
});
});
How can I solve this issue? Thank you in advance.