t3chnoboy / amazon-product-api Goto Github PK
View Code? Open in Web Editor NEW:credit_card: Amazon Product Advertising API client
:credit_card: Amazon Product Advertising API client
Hi guys,
Out of curiosity, I just wanted to know if there is any reason not to use the latest version of the Amazon Product Advertising API (2013-08-01). Are there any differences or performance related? Maybe for compatibility/legacy support?
Thanks!
Hello,
after i installed & imported the package, react-native can't compile any more, here is the error
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 758): UnableToResolveError: Unable to resolve module crypto from C:\bitbucket apps\2017\myApp\node_modules\amazon-product-api\lib\utils.js: Module does not exist in the module map or in these directories:
C:\bitbucket apps\2017\myApp\node_modules\amazon-product-api\node_modules
, C:\bitbucket apps\2017\myApp\node_modules
Would it be possible to get a country based search ability ? I'm migrating from php to node.js on my server, and I just realized that certain books don't have the "EditorialReview" in their query response.
After digging around a bit, I've figured that books that have EditorialReviews on amazon.com return the tag, whereas books that have EditorialReviews on amazon.in don't return the reviews.
Is there any way to incorporate this into your node.js package ?
Example :
Name : Third Best
Author : Arjun Rao
ISBN : 9350093014
This book doesn't exist on amazon.com. ( unless I search for a kindle version ).
It is however available on amazon.in.
Therefore is there any way to perform country based searches ?
Hello guys,
More of a question than an issue, but is there a way to filter the "responseGroup" parameter for the itemSearch ? For example, I'm only interested in LowestNewPrice in OfferSummary ?
And can I receive let's say 2-3 items rather than the whole "ItemPage" ?
Just to save some bandwidth
I have an express server that is listening to port 3000
var http = require('http');
var path = require("path");
var express = require("express");
var app = express();
app.get("/", function(req, res) {
res.sendFile(__dirname + "/index.html");
});
app.use('/dist', express.static('dist'));
app.listen(3000);
The index.html file is pointing to a js file called bundled.js
<script type="text/javascript" src="dist/bundled.js"></script>
I am using browserify to make bundled.js from scripttest.js, because I get an error (require is not defined) from var amazon = require('amazon-product-api');
. scripttest.js looks like this:
var amazon = require('amazon-product-api');
var client = amazon.createClient({
awsId: "awsID",
awsSecret: "awsSecred",
awsTag: "awsTag"
});
function search() {
client.itemSearch({
director: 'Quentin Tarantino',
actor: 'Samuel L. Jackson',
searchIndex: 'DVD',
audienceRating: 'R',
responseGroup: 'ItemAttributes,Offers,Images'
}, function(err, results, response) {
if (err) {
console.log(err);
} else {
console.log(results); // products (Array of Object)
console.log(response); // response (Array where the first element is an Object that contains Request, Item, etc.)
}
});
}
window.onload = function () {
search();
};
replacing the credentials of course.
The error I'm getting now is "No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled."
I believe the issue is arising because I'm not making a call on the domain that I registered for the product developer api with, but instead on localhost.
After googling the error message, I am aware of this article in the docs: http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html#how-to-cors-prerequisites am not sure how to implement the instructions in the article or if there is another solution to get this working?
Beginner here so ELI5 if possible, thanks.
Would it be too much effort to add BrowseNodeLookup? This is a method I need to call. I'm a .NET developer and am just starting out with Node.js. I would do it myself but it may be a little too time consuming for me. I was hoping that someone might be able to make that change more quickly than I would be able to. Looking at the source code the majority of it is done. The hardest part is creating the signature (which looks like it is already done). I am also guessing that IteamSearch would need to be updated as well to take BrowseNodeId as a parameter.
Thanks in advance. This is a high priority feature request for us.
Can we get support for the Merchant ID for itemLookup?
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/ItemLookup.html
when i call this function i get: undefined
for example:
var r = amazonGetItem('B002SSUQFG');
function amazonGetItem(asin) {
var result;
client.itemLookup({
idType: 'ASIN',
itemId: asin
}).then(function (results) {
result = results;
}).catch(function (err) {
console.log(err);
result = '';
});
return result;
}
i want to wait untill the temLookup return data?
thanks.
Hi,
Thanks for creating this client, I am trying to fetch product by UPC
by following the example here:
client.itemLookup({
idType: 'UPC',
itemId: '884392579524'
}).then(function(results) {
console.log(JSON.stringify(results));
}).catch(function(err) {
console.log(err);
});
However, I am getting the following error when doing so, am I missing anything or amazon API now requires additional param for this call?
[
{
"Error": [
{
"Code": [
"AWS.MinimumParameterRequirement"
],
"Message": [
"Your request should have atleast 1 of the following parameters: 'Keywords','Title','Power','BrowseNode','Artist','Author','Actor','Director','AudienceRating','Manufacturer','MusicLabel','Composer','Publisher','Brand','Conductor','Orchestra','TextStream','Cuisine','City','Neighborhood'."
]
}
]
}
]
Thank you!
Can this be made simpler with Synchronous methods?
Hi,
My name is Duc, my job is developer website. I need a Product Advertising API Associate account, but I can not register because I do not have an online shop. I just need it to get the products of amazon. You can sell or share account Associate ?
Sorry for my English is not good
Thanks!
It just took me two hours to figure out that the promise only returns the array of products where as the callback returns both the array of products and the response. Why is that, and would you accept a pull request to fix the promise?
Callback: https://github.com/t3chnoboy/amazon-product-api/blob/master/lib/index.js#L19
Promise: https://github.com/t3chnoboy/amazon-product-api/blob/master/lib/index.js#L21
In other words, if you use the promise, you can only ever get back the first page of information because it doesn't return the Items object that contains things like:
<TotalResults>376</TotalResults>
<TotalPages>38</TotalPages>
among other things...
Is this only for amazon.com? Or can it be used for the other locales too?
Maybe JavaScript Standard Style?
Hi all!
This is a question rather than an issue: What is in your opinion the best way to throttle requests to the Amazon Product API? The initial limit is 1 req/s, increasing by 1 req/s for every $4,700 in goods sold by your awsTag
.
I'm currently using Bottleneck with a limit of 1 request per 2000ms and I'm still getting many RequestThrottled
errors. So it doesn't seem to be playing well with this module or the API.
Are any of you throttling your requests? How? It would be great if this feature was included, as similar projects in other languages have a MaxQPS
option.
Thanks!
We should implement all the Amazon API operations. We could do a milestone?
Would be good to add a !response
check on the following line.
https://github.com/t3chnoboy/amazon-product-api/blob/master/lib/index.js#L19
If internet connection is down this causes an exception:
TypeError: Cannot read property 'statusCode' of undefined
at Request._callback (/Users/hek/git/nodebb-plugin-affiliate/node_modules/amazon-product-api/lib/index.js:19:21)
at self.callback (/Users/hek/git/nodebb-plugin-affiliate/node_modules/request/request.js:368:22)
at Request.emit (events.js:107:17)
at Request.onRequestError (/Users/hek/git/nodebb-plugin-affiliate/node_modules/request/request.js:1025:8)
at ClientRequest.emit (events.js:107:17)
at Socket.socketErrorListener (_http_client.js:271:9)
at Socket.emit (events.js:107:17)
at net.js:940:16
at process._tickDomainCallback (node.js:381:11)
Is there any plan to implement the Similarity Lookup operation?
Is there a chance to get this to run for react-native?
The response from Amazon states that SearchIndex cannot be present when searching by ASIN. I am about to submit a fix for this.
Hello,
I implemented this meteor package and I am getting this error message.
I20170110-20:50:42.011(-8)? title:Building Java Programs
I20170110-20:50:42.012(-8)? author:Stuart Reges
I20170110-20:50:42.248(-8)? { '$': { xmlns: 'http://ecs.amazonaws.com/doc/2013-08-01/' },
I20170110-20:50:42.248(-8)? Error: [ { Code: [Object], Message: [Object] } ],
I20170110-20:50:42.248(-8)? RequestId: [ 'a5d13542-51ec-4868-9662-172160dc4001' ] }
Why is this occuring?
Any help would be appreciated.
BrowseNodeLookup is not working as expected. This my code below:
var credentials = {
awsId: 'myId',
awsSecret: 'mysecret',
awsTag: 'mytag'
};
amazon.createClient(credentials).browseNodeLookup({}, function (err, data) {
console.log(arguments);
if (err) {
res.send(err);
}
res.send(data);
}
It appears as though I get data back but I see this error in my console when I run my express NodeJS app on line 28:54 in index.js
Ill follow up with more info later if required.
Is there any solution in place for caching requests?
client.itemSearch({
responseGroup: 'Images,ItemAttributes,OfferFull',
keywords: 'potatoes'
}, function (err, results, response) {
if (err) {
console.log(err);
} else {
for (var i in results) {
if (results.hasOwnProperty(i)) {
console.log(results[i].Offers[0].Offer[0].OfferListing[0].Price[0].FormattedPrice[0]);
}
}
}
});
I’m trying to get the product current price, but with the following code I receive always the LowestNewPrice. I don’t understand because are different objects.
Here is a example of output.
In scratchpad I receive the expected result and more than this, I get succesfully the other elements like price or images, but for price it’s not working.
Regards,
Silviu
I didn't see instructions on how to set the Locale. Can I do:
var client = AmazonShopping.createClient({
awsId: "AKIAIZWLasdfasdfasdfasdfd",
awsSecret: "yzOAltW4asdfasdfasdf",
awsTag: "xxxxxxx",
locale : "Mexico"
});
I tried to install this library and am getting tons of errors:
https://gist.github.com/jnarowski/f836362100f35b4fb268
Is this package still functional? I just did an NPM install
How I get response (not results) to extract TotalPages, TotalResults, MoreSearchResultsUrl and so on using promises?
You show an example using callbacks to get it but with promises online get the results.
Thanks in advance
Does this library support checking amazon coupon code?
client.itemSearch({
keywords: 'Pulp fiction'
}, function(err, results) {
if (err) {
console.log(err);
} else {
console.log(results);
}
});
With this query, the expected params are:
{ Condition: 'All',
ItemPage: '1',
Keywords: 'Pulp fiction',
Version: '2013-08-01',
Timestamp: '2015-08-27T14:51:10.328Z',
ResponseGroup: 'ItemAttributes',
SearchIndex: 'All',
Service: 'AWSECommerceService',
Operation: 'ItemSearch' }
but when I printed the params, I got this:
{ Keywords: 'Pulp fiction',
Version: '2013-08-01',
Timestamp: '2015-08-27T14:51:10.328Z',
Service: 'AWSECommerceService',
Operation: 'ItemSearch' }
Less of an issue but more of a question. Is there a way to set the number of results you want?
Can only search by keyword.
there are no options to enter the locale information lets say 'IN' for 'INDIA' because of which there is no response from the server.. :(
I keep getting an object error with a random string of chars. doesn't really help and I'm not sure what the problem is.
I'm trying to set up a price tracking site and am having the hardest time trying to get connected to the amazon api I'm not sure if there was a recent update but any help using javascript / node.js would be greatly apprecieted.
-Thanks,
Jeremy
As seen in PR #62 by @oldstreams.
Is there any way to get all the products from amazon with out any restrictions like 10 pages.
I am wanting to use this in the UK, but the info coming back from Amazon is all for Amazon.com. Is there a parameter to change to other regions?
Thanks for the help.
Example: http://www.amazon.com/gp/offer-listing/1935703013/ref=olp_f_freeShipping?ie=UTF8&f_new=true
Best price is $7.45 including delivery.
amazon-product-api is return "Amount": [ "580"
e.g $5.80 which then has $4 shipping when you goto the url.
client.itemLookup({
idType: 'ISBN',
itemId: '1935703013',
condition: 'New',
responseGroup: 'OfferFull'
I'm making a service which will take eBooks from amazon and post them to facebook, which needs to be accessing the UK version of amazon. It appears that there is no way to use UK browseNodes. When I try and use one, it returns:
[ { Error: [ [Object] ] } ]
.
I've tried changing the webservices.amazon.com
to webservices.amazon.co.uk
, but no luck.
Hello there,
What is the awsTag in amazon.createClient function? I have the access key ID and secret access key from product advertising API. If you can help, I will appreciate it.
Thanks,
Anand
Is there a way to setup which country/region I want search? (Amazon JP, etc)
For BrowseNodeLookup Operation I am getting the following error.
{"$":{"xmlns":"http://ecs.amazonaws.com/doc/2005-10-05/"},"Error":[{"Code":["UnsupportedVersion"],"Message":["Version 2005-10-05 is unsupported. Please use 2011-08-01 or greater instead."]}],"RequestId":["ee03c036-5049-4952-94f4-021c642f3ab0"]}
I would like to incorporate the amazon-product-api into a React app I have created. Is that possible? I'm getting a lot of errors when I run webpack.
See below. Thanks!
ERROR in ./~/tough-cookie/package.json
Module parse failed: /Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/tough-cookie/package.json Unexpected token (2:9)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:9)
at Parser.pp$4.raise (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp.semicolon (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:581:61)
at Parser.pp$1.parseExpressionStatement (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:966:10)
at Parser.pp$1.parseStatement (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:730:24)
at Parser.pp$1.parseBlock (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:981:25)
at Parser.pp$1.parseStatement (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:709:33)
at Parser.pp$1.parseTopLevel (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/Parser.js:902:15)
at DependenciesBlock.<anonymous> (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/NormalModule.js:104:16)
at DependenciesBlock.onModuleBuild (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
at nextLoader (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
at /Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
at Storage.provide (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:52:20)
at CachedInputFileSystem.readFile (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:140:24)
at DependenciesBlock.onLoadPitchDone (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack-core/lib/NormalModuleMixin.js:255:7)
at DependenciesBlock.loadPitch (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack-core/lib/NormalModuleMixin.js:182:27)
at DependenciesBlock.doBuild (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack-core/lib/NormalModuleMixin.js:241:4)
at DependenciesBlock.build (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/NormalModule.js:84:14)
at Compilation.buildModule (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/Compilation.js:126:9)
at /Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/Compilation.js:309:10
at /Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/NormalModuleFactory.js:58:13
at NormalModuleFactory.applyPluginsAsyncWaterfall (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/tapable/lib/Tapable.js:75:69)
at onDoneResolving (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/NormalModuleFactory.js:38:11)
at onDoneResolving (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/NormalModuleFactory.js:121:6)
at /Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/NormalModuleFactory.js:116:7
at /Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/node_modules/async/lib/async.js:726:13
at /Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/node_modules/async/lib/async.js:52:16
@ ./~/tough-cookie/lib/cookie.js 38:14-40
ERROR in ./~/mime-db/db.json
Module parse failed: /Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/mime-db/db.json Unexpected token (2:40)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (2:40)
at Parser.pp$4.raise (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:2221:15)
at Parser.pp.unexpected (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:603:10)
at Parser.pp.semicolon (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:581:61)
at Parser.pp$1.parseExpressionStatement (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:966:10)
at Parser.pp$1.parseStatement (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:730:24)
at Parser.pp$1.parseBlock (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:981:25)
at Parser.pp$1.parseStatement (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:709:33)
at Parser.pp$1.parseTopLevel (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:638:25)
at Parser.parse (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:516:17)
at Object.parse (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/acorn/dist/acorn.js:3098:39)
at Parser.parse (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/Parser.js:902:15)
at DependenciesBlock.<anonymous> (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack/lib/NormalModule.js:104:16)
at DependenciesBlock.onModuleBuild (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack-core/lib/NormalModuleMixin.js:310:10)
at nextLoader (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack-core/lib/NormalModuleMixin.js:275:25)
at /Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/webpack-core/lib/NormalModuleMixin.js:259:5
at Storage.finished (/Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:38:16)
at /Users/markmcquillen/Desktop/UdemyReact/extendingReactTodo/node_modules/graceful-fs/graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:404:3)
@ ./~/mime-db/index.js 11:17-37
Hi
I checked my keys on a scratchpad but I still get this error whether it itemSearch or ItemLookUp
{ '$': { xmlns: 'http://ecs.amazonaws.com/doc/2013-08-01/' },
Error:
[ { Code: [ 'InvalidClientTokenId' ],
Message: [ 'The AWS Access Key Id you provided does not exist in our records.' ] } ],
RequestId: [ 'ad5243d3-04b2-4bd7-8908-82789ed48233' ] }
Code:
const amazon_client = amazon.createClient({
awsID: 'smthg',
awsSecret: 'smthg',
awsTag: 'smthg'
});
amazon_client.itemLookup({
idType: 'UPC',
itemId: '884392579524'
}).then(function(results) {
console.log(JSON.stringify(results));
}).catch(function(err) {
console.log(util.inspect(err, false, null));
});
I ran a mocha test and everything seems to break.
When I plugged in my credentials from Amazon, I don't get an error but I get results = undefined.
node v0.12.4
amazon-product-api v0.3.4
I think there is no need for a wiki, the README is very complete.
I've forked this and added a "CartCreate" option here: https://github.com/donovanh/amazon-product-api
Having some trouble with the tests though - I think it could be a throttling issue as it hits Amazon's API repeatedly, so I'm seeing random fails and can't get the tests to run successfully. Do you think it could be worth faking the API requests and design the tests against a static definition of what the API expects, rather than have the tests test the API itself?
Feels to me that it would be efficient to test the code in isolation by abstracting the API calls.
Does this API work with Ionic 2?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.