Closed moggiex closed 4 years ago
Having a dig around.
src/index.js line 33
if (params.parameters !== null || params.parameters !== 'undefined') {
getItemsRequest.Resources = params.parameters
}
This doesn't appear to be being set.
If I force this with:
if (params.parameters !== null || params.parameters !== 'undefined') {
getItemsRequest.Resources = params.parameters
}
getItemsRequest.Resources= ["ItemInfo.ExternalIds", "ItemInfo.ProductInfo"];
The response is:
data { Items:
[ { ASIN: 'B000Y854WC',
DetailPageURL: 'https://www.amazon.co.uk/dp/B000Y854WC?tag=chromeapp02-21&linkCode=ogi&th=1&psc=1',
ItemInfo: [Object] } ] }
data { ExternalIds:
{ EANs: { DisplayValues: [Array], Label: 'EAN', Locale: 'en_US' },
UPCs: { DisplayValues: [Array], Label: 'UPC', Locale: 'en_US' } },
ProductInfo:
{ Color: { DisplayValue: 'Blue', Label: 'Color', Locale: 'en_GB' },
IsAdultProduct: { DisplayValue: false, Label: 'IsAdultProduct', Locale: 'en_US' },
ItemDimensions: { Weight: [Object] },
Size: { DisplayValue: 'N/A', Label: 'Size', Locale: 'en_GB' },
UnitCount: { DisplayValue: 1, Label: 'NumberOfItems', Locale: 'en_US' } } }
Found the issue and pushed an update over.
if (params.resources !== null || params.resources !== 'undefined') {
Hi @moggiex , Thanks for finding the issue and the solution. Can you make a PR, so that I can get your update?
Ps @arifulhb I only use git for personal projects, so NFI on what a 'PR' is
@moggiex No worries then. I'll re-implement your solution and update my source.
Meanwhile, you can check this about PR https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests
Thanks for your help.
api.getItemById(['B000Y854WC'], { // resources: resourceList, resources: ["ItemInfo.ExternalIds", "ItemInfo.ProductInfo"], // condition: condition.Any })
I found the issue. You actually sending resources
in parameter, which actually should be parameters
. Please check this doc https://github.com/arifulhb/amazon-pa-api50#get-a-single-or-array-of-products-via-asin
let resourceList = parameters.getItemInfo
resourceList = resourceList
.concat(parameters.getImagesPrimary)
api.getItemById(['B079JD7F7G'], {
parameters: resourceList, // <<<< Follow this.
condition: condition.Any
}).then((response) => {
console.log(' ===== find by Item ids =====')
console.log('data', response.data)
}).catch((error) => {
console.log('Error: ', error)
})
Howdy,
No matter what I set for the resources, I always seem to get the same response back for any ASIN.
Try B000Y854WC on the UK site, eg below:
The response is always the same, regardless of what resource value is set.
Am I doing something wrong here @arifulhb?