Hi Friends,
I am new to magento and nodeJS. I am here to request help from you.
I followed this http://www.magentocommerce.com/api/rest/permission_settings/roles_configuration.html to configure role.
Framework : Strong Loop
My Requirement : User will feed email and name in mobile app, using nodeJS i have to POST/PUT user given details into magento.
Doubt: Is it possible to create new customers using rest webservice(admin role)?
Node JS code:
var OAuth = require('oauth').OAuth;
var apiUrl = "http://domain/magento/api/rest/customers"
var oa = new OAuth(temporaryCredentialsRequestUrl, accessTokenRequestUrl, consumerKey, consumerSecret, 1.0, "http://localhost:3000/explorer", "HMAC-SHA1");
oa.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results){
if(error) {
console.log('error');
console.log(error);
}
else {
oa.get(apiUrl, oauth_token, oauth_token_secret,
function (error, data, response) {
var feed = JSON.parse(data);
console.log(data);
});
}
});
Using this program i am able to generate Access Token and Access Token Secret.
But unable to read customers althought getting below error.
{"messages":{"error":[{"code":401,"message":"oauth_problem=token_rejected"}]}}
If my approach is wrong, please guide me how to.
Thanks in advance