Reputation: 11
I'm trying to create an app using WooCommerce API.
index.js:
var WooCommerceAPI = require('woocommerce-api');
// var WPAPI = require('wpapi');
var querystring = require('querystring');
var WooCommerce = new WooCommerceAPI({
url: 'http://shop3.adinweb.ir',
consumerKey: 'ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
consumerSecret: 'cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
wpAPI: true,
version: 'wc/v2',
queryStringAuth: true
});
WooCommerce.get('products?page=1', function(err, data, res) {
console.log(err);
console.log(res);
});
The result:
I'm sure the consumerKey
and consumerSecret
are correct. I have tried many times :|
Please guide me. What's wrong here?
Upvotes: 1
Views: 491
Reputation: 65
I am using the woocommerce package and it works fine with 2 changes.
With these 2 changes the plain "woocommerce" package works like a charm.
Upvotes: 0
Reputation: 11
You logging out the wrong thing I suppose? Should be:
console.log(data)
You must log out the data and not the response.
Upvotes: 1