Xero - beautiful accounting software

Xero Developer Help Center

Xero Developer Community

Community > Wrapper libraries >

Not able to add contact

Started by kapil vats -   in Wrapper libraries

var express = require("express");
var Xero = require('xero');
var fs = require('fs');

var app = express();

var CONSUMER_KEY="85DY1IIUNG1P93GJHRTYOKCUXTIB8F";
var CONSUMER_SECRET="ZBJFFDBMIKQ8SBURMSNA9DEU6Y5O5T";
var RSA_PRIVATE_KEY = fs.readFileSync("C:/Users/HP/Downloads/MVC/xero-master" + "/.ssh/id_rsa");

var xero = new Xero(CONSUMER_KEY, CONSUMER_SECRET, RSA_PRIVATE_KEY);
var request;
// Single
request = {
Name: 'kapil vats'
};

xero.call('POST', '/Contacts?SummarizeErrors=false', request, function(res, err, json) {
if (err) {
res.status(err.statusCode);
res.write(JSON.stringify(err));
res.end();
} else {
console.log("Successfully Added!");
}
});

app.listen(3000, function () {
console.log("Listening...");
});
Did you get any error messages? If so, what is the error message?

Please not that it is a security risk to put an application's Consumer Key and Secret in a public forum as they can be used to identify your application.
 

Welli Abdullah (Xero Staff)