Name: xtuple-nodejs-rest-client
Owner: xTuple
Description: This repository contains the source code for the Node.js REST API client library for xTuple. The client library uses the Google API client library for Node.js.
Created: 2014-07-21 05:34:34.0
Updated: 2017-01-24 10:55:46.0
Pushed: 2014-11-17 16:43:55.0
Size: 290
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
xTuple ERP Node.js REST API Client Library using the Google APIs Client Library for Node.js. For more information about xTuple's web application, look at the source code. You can also find an example Node.js REST API cient here.
Before you can use this client with xTuple's OAuth 2.0 Server, you need to install the OAuth 2.0 extension in your xTuple application and create a reference for a new OAuth 2.0 Client. Be sure to select a “Client Type” of “Service Account” and ensure that “Delegated Access” is checked. This will generate a private key and give you all the other information that you wll need to connect to the xTuple REST API.
Clone this repository and run npm install
or npm install xtuple-rest-client
Convert your key.p12 file to key.pem and copy it to the keys
folder:
openssl pkcs12 -in keys/key.p12 -nocerts -nodes | openssl rsa -out keys/key.pem
This key and the folder are in the .gitignore and should never be committed to source control.
Enter Import Password: 'notasecret'
cp sample.env .env
Open the .env file and change the information to match what was provided by the xTuple OAuth 2.0 extension. This .env file should also never be committed to source control.
_ = require('underscore'),
ient = require('xtuple-rest-client');
Client(function (client) {
ient.query({
type: 'ToDo',
method: 'list',
params: { maxResults: 50 },
callback: function (err, result) {
if (err) {
console.log('Error:', err);
}
if (result) {
console.log('To Dos:');
_.map(result.data.data, function (obj) {
console.log('Id:', obj.uuid);
console.log('Name:', obj.name);
console.log('Description:', obj.description);
});
}
}
;
Copyright (c) 2012-2013 xTuple http://www.xtuple.com/