A nodejs module for interacting with the ConnectWise REST API.


0.1.54 years ago4 years agoMinified + gzip package size for @liongard/connectwise-rest in KB



npm version npm downloads

A nodejs module for interacting with the ConnectWise REST API. This module is currently under construction. This module provides bindings for ease of development against the ConnectWise REST API.


  • ConnectWise 2015.3+, though these functions are written for ConnectWise 2016.1 APIs (API3.0 v1.0.0).
  • ConnectWise API keys (available on ConnectWise 2015.3+), or API Only Member keys (only available on ConnectWise 2015.6+). See the documentation for more details.


See the documentation here


Create a new API key, or API Only Member, then instantiate the module.

    var ConnectWiseRest = require('connectwise-rest');
    var cw = new ConnectWiseRest({
        companyId: 'company',
        companyUrl: 'your.connectwise.com',
        publicKey: '<public key>',
        privateKey: '<private key>',
        entryPoint: 'v4_6_release', // optional, defaults to 'v4_6_release'
        timeout: 20000,             // optional, request connection timeout in ms, defaults to 20000
        retry: false,               // optional, defaults to false
        retryOptions: {             // optional, override retry behavior, defaults as shown
          retries: 4,               // maximum number of retries
          minTimeout: 50,           // number of ms to wait between retries
          maxTimeout: 20000,        // maximum number of ms between retries
          randomize: true,          // randomize timeouts
        debug: false,               // optional, enable debug logging
        logger: (level, text, meta) => { } // optional, pass in logging function
        .then(function (result){
            //do something with results
        .catch(function (error){
            //handle errors

Or if you only require access to one API component:

    var ConnectWiseRest = require('connectwise-rest');
    var tickets = new ConnectWiseRest(options).ServiceDeskAPI.Tickets;
        .then(function (result){
            //do something with results
        .catch(function (error){
            //handle errors

You can also manually access the API:

    var ConnectWiseRest = require('connectwise-rest');

    var api = new ConnectWiseRest(options).API.api;

    api('/path/to/api', 'POST', {
        'param1': 'val1',
        'param2': 'val2'
    .then(function (result){
        //do something with results
    .catch(function (error){
        //handle errors

Cloud-Hosted ConnectWise

To access cloud-hosted ConnectWise, use the companyUrl of api-na.myconnectwise.net and override the default entryPoint.

    options = {
        companyId: 'company',
        companyUrl: 'api-na.myconnectwise.net',
        entryPoint: 'v2016_2',
        publicKey: '<public key>',
        privateKey: '<private key>'

Implemented APIs

Module API Status
Company API Companies Complete
Company API CompanyTeams Complete
Company API Configurations Complete
Company API Contacts Complete
Finance API Additions Complete
Finance API Adjustments Complete
Finance API Agreements Complete
Finance API AgreementSites Complete
Finance API BoardDefaults Complete
Finance API WorkRoles Complete
Finance API WorkTypeExclusions Complete
Finance API WorkTypes Complete
Project API Projects Complete
ScheduleAPI ScheduleEntries Complete
ScheduleAPI ScheduleTypes Complete
Service Desk API Boards Complete
Service Desk API BoardTeams Complete
Service Desk API Priorities Complete
Service Desk API ServiceNotes Complete
Service Desk API Statuses Complete
Service Desk API Tickets Complete
System API Members Complete
System API Reports Complete
Time API TimeEntries Complete


Code Examples

Get ticket 1234 and print ticket number, summary and status.

        .then(function (res) { console.log(res.id, res.summary, res.status.name); })
        .catch(function (err) { console.log(err); });

Create new ticket on service board, then print the returned ticket number, or any errors

        summary: "This is the summary",
        board: {
            name: "Service Board"
        company: {
            identifier: "ABC" //company ID
        initialDescription: "ticket description",
        recordType: "ServiceTicket"
        //can also pass in any other Ticket object settings as needed
    .then(function (res) { console.log(res.id); });
    .catch(function (err) { console.log(err); });    

Change the status of a ticket

    updateTicket(1234, [{
        op: 'replace',
        path: 'status',
        value: {id: 123} //id of the status to change to, find with boards.getBoards and status.getStatuses
    }, {
        //second or more operations
    .then(function(res) { //do something with returned ticket });
    .catch(function(err) { //do something with errors });    


Valid example conditions string:

    var conditions = '(contact/name like "Fred%" and closedFlag = false) and dateEntered > [2015-12-23T05:53:27Z] or summary contains "test" AND  summary != "Some Summary"'

Error message returned from server when invalid conditions are passed in:

Expected a boolean value, not a numeric. String values should be enclosed with double or single quotes; DateTime values should be enclosed in square brackets; numbers should consist of only digits, and optionally a decimal point and a negation sign; boolean values should be indicated with the keywords true or false; null values should be indicated by the keyword null.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.