QuickBooks Online does not have an Intuit produced package for Node.js, but luckily one of the members of the QuickBooks Online community stepped up and contributed their own. In this post I’ll be going over how to get the package installed and making your first API request.
0.1 Have Node.js Installed
If you haven’t already, head over to https://nodejs.org/ and install Node.js for your system. You can check to see if you have Node already installed by opening up a command line and executing
node -v
0.2 Create an app on Intuit Developer
Head over to https://developer.intuit.com/ and log in to (or create) your Intuit Developer account, create a new app, and leave that tab open for later. You’ll be coming back to copy your OAuth credentials into the example code.
1. Install the node-quickbooks package
In the command line navigate to a location that you’ll want to work in and run
npm install node-quickbooks
This will create a new folder named ‘node-quickbooks’ and download the node-quickbooks package from npm. You should get an output similar to this:
2. Open up the example
From there you can navigate into the package that you just downloaded and into the example folder.
cd node_modules/node-quickbooks/example
Here is a bare-bones express application to go through the basics of authorizing your application and making the first few API calls. First you will need to install any dependencies with
npm install
which will add all of the required packages to example project. Open up the
app.js
file and copy in the OAuth client key and secret from your application on Intuit Developer.
Then you should be able to run the application with
node app.js
You should get a notice saying that the express server is running on port 3000. Open up a browser window and navigate to localhost:3000/start. From there you can click on the familiar Connect to QuickBooks button and be able to go through the authorization dialog for your new application. After you finish the authorization, check your command line and you should see a list of all the accounts for the QuickBooks file that you connected to the app. Success!
3. Learning More
This example uses the developer sandbox but switching over to production QuickBooks accounts is as easy as changing an argument when instantiating the QuickBooks object. The documentation for the client can be found on GitHub here: https://github.com/mcohen01/node-quickbooks
Leave a Reply