arifulhb / amazon-pa-api50

Amazon Product Advertising API v5.0 for JavaScript and NodeJs
https://www.npmjs.com/package/amazon-pa-api50
MIT License
29 stars 9 forks source link

Item Value and availability #21

Closed zerofelx closed 3 years ago

zerofelx commented 3 years ago

Hi good day

I am trying to search for products on Amazon and I tried to add the parameter "availability" but it doesn't work because it brings products out of stock, I would like to know if I'm doing it right let resourceList = resources.getAll; let word = "Shoes";

api.search(word, { parameters: resourceList, condition: condition.New, itemCount: 1, OfferCount: 1, availability: 'available' }).then(response => { let data= response.data console.log(JSON.stringify(data)) }).catch(error => { console.log(error) })

On the other hand Is there a way to bring the price of the product? I've tried different ways but still can't get it. Thank you very much for your attention and collaboration

valentino-dicianni commented 3 years ago

about prices, I had the same problem. I solved it adding this piece of code to the resources.js file: getOffers :[ "Offers.Listings.Price" ]

zerofelx commented 3 years ago

about prices, I had the same problem. I solved it adding this piece of code to the resources.js file: getOffers :[ "Offers.Listings.Price" ]

I really appreciate it! It works perfectly.

Since where I am uploading the project I cannot alter the elements in node_modules so I just created the following block and used it as if using "resources" from the API:

const myResources = {
    getPrice: [
        "Offers.Listings.Price"
      ],

      getAvailability: [
        "Offers.Listings.Availability.Message",
        "Offers.Listings.Availability.Type"
      ],

      test: [
        "Offers.Summaries.OfferCount"
      ]
}

And later:

let resourceList = resources.getAll
resourceList = resourceList.concat(myResources.getPrice)