Skip to main content
Skip table of contents

Example Application - Chart of Accounts

Complete the steps described in the rest of this page to create a simple Node command-line application that makes requests to the Boss Insights API.

What you will need:

  • Boss insights account

  • Postman

  • Latest version of Node.Js 

  1. Test Connection with postman

The fastest way to get started with our server-side API is using Postman (a 3rd party API development tool), if you've not used it before then we recommend checking https://learning.postman.com/

  1. Once Postman is downloaded visit https://api.bossinsights.com/ and click the run in Postman button on the top right corner. 

2. Once Postman is open, click on the eye in the top right corner and set baseUrl to “myCompanyName.myintranetapps.ca/api.” where “myCompanyname” is your company's name.

3. Now we must set basic authentication. In the left sidebar click on the “Data Dock” title and you will see a  screen asking for authorization. Change type to basic auth and enter your username and password.

4. Now we are all set up to make requests to the Boss insights API. We can start with the “accounts” end point.  

  • Click on the folder labeled accounts and go to the GET request for “Retrieves the collection of accounts”.

  • Click on the blue send button in the top right hand corner to send the request. If accounts are connected you will be returned a JSON object with all of the accounts. If there are no accounts connected then it will return an empty object eg.”[ ]”.

5. Certain endpoints require more parameters. For example, the balance sheet endpoint requires start and end date, accounting method, and page. To learn more about how we deal with dates visit: https://docs.bossinsights.com/data-platform/API.1096286209.html

  1. Make a test API request

Now that we know that we can connect to the API via postman, let's convert it into a simple node.js application to see if we can get any data returned.


2. Make a test API request

Now that we know that we can connect to the API via postman, let's convert it into a simple node.js application to see if we can get any data returned.

  1. The fastest way to get started is by visiting https://api.bossinsights.com/ and select which endpoint you would like to connect to.

  2. On the right hand side of the screen you will see some example code to make a request to the API.

  3. Below is example code to make a request. Where auth is your “username:password”, protocol is “https”, and hostname is  “myCompanyName.myintranetapps.ca”.

JS
var https = require('follow-redirects').https;
var fs = require('fs');
var auth = "admin:secret";
var protocol = "https:";
var hName = "spendo.aboutus123.com";

var options = {
    auth: "username:password",
    protocol: https,
    method: "GET",
    hostname: "myCompanyName.myintranetapps.com",
    path: "/api/accounts",
    headers: {},
    maxRedirects: 20,
  };

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

req.end();

Parameter

Definition

auth:

auth is your username and password for your account. where username will be replaced by your username and password will be replaced with your password

protocol:

The protocol that will be used is https

method:

method is GET

hostname:

Host name will be “myCompanyName.myintranetapps.ca”. where myCompanyName will be replaced with your companies name.

path:

In this case the path is /api/accounts. However accounts can be replaced with whichever endpoint you are connecting too.

Result will be a JSON object:

JSON
[
    {
        "id": "quickbooks-1",
        "code": null,
        "taxType": null,
        "bankAccountNumber": null,
        "bankAccountType": null,
        "currencyCode": "USD",
        "fullyQualifiedName": "Services",
        "name": "Services",
        "classification": "Revenue",
        "accountSubType": "ServiceFeeIncome",
        "currentBalanceWithSubAccounts": 0,
        "created": "2021-02-04T22:42:05+00:00",
        "modified": "2021-02-04T22:42:05+00:00",
        "accountType": "Income",
        "currentBalance": 0,
        "active": true,
        "subAccount": false,
        "description": null,
        "srcId": "1",
        "parentAccountId": null,
        "deleted": false
    }
  ]

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.