npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

connectwise-manage-rest-api

v1.2.0

Published

A lightweight interface that preserves the syntax but removes as much boiler plate code as possible for using the ConnectWise REST API's.

Downloads

52

Readme

ConnectWise Manage REST API

A lightweight interface that preserves the syntax but removes as much boiler plate code as possible for using the ConnectWise REST API's.

api documentation

https://developer.connectwise.com/REST_Documentation

features

  • uses promises
  • automatic API version lookup with option to specify specific version
  • option to retry in case of timeout
  • works in browser and node.js
  • system report data normalizer

usage


const manage = require ('connectwise-manage-rest-api')({
	fqdn: '​api-na.myconnectwise.net',
	companyId: '################',
	publicKey: '################',
	privateKey: '################',

	// optional settings
    version: 'v4_6_release',                           // if omitted, latest version will be looked up
	timeoutRetries: 10,                                // number of times to retry request in case of timeout error
    clientId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'   // see https://developer.connectwise.com/ClientID this will eventually be a required setting
});

(async () => {
    const resultGraph = await manage.get(`system/info`);
    console.log(resultGraph);
}).catch(error => {
    console.log(error);
})();

see test.js for more examples

system report normalizer

const config = require('./test-config');
const log = x => console.log(require('util').inspect(x, {colors: true, depth: null}));
const normalize = require('./normalize-system-report');
const manage = require ('./index')(config);

(async () => {
    const holidayReportInColumnarFormat = await manage.get('system/reports/holiday');
    const holidayDataInSaneObjectFormat = normalize(holidayReportInColumnarFormat);
    log(holidayReportInColumnarFormat);
    log(holidayDataInSaneObjectFormat);
})().catch(log);    

transforms this

{ column_definitions:
   [ { Holiday_List_RecID: { type: 'Numeric', isNullable: false } },
     { Holiday_List_Name: { type: 'Text', isNullable: false } },
     { Holiday_Date: { type: 'DateTime', isNullable: false } },
     { Time_Start: { type: 'DateTime', isNullable: true } },
     { Time_End: { type: 'DateTime', isNullable: true } },
     { Description: { type: 'Text', isNullable: false } },
     { Last_Update_UTC: { type: 'DateTime', isNullable: false } },
     { Updated_By: { type: 'Text', isNullable: false } },
     { Time_Zone: { type: 'Text', isNullable: true } } ],
  row_values:
   [ [ 1,
       'Standard Holidays',
       '2016-12-26T05:00:00Z',
       null,
       null,
       'Christmas Day',
       '2015-10-02T18:14:42Z',
       'chigley',
       'Eastern Standard Time' ],
     [ 1,
       'Standard Holidays',
       '2016-12-23T05:00:00Z',
       null,
       null,
       'Christmas Eve',
       '2015-10-02T18:14:32Z',
       'chigley',
       'Eastern Standard Time' ]
   ]
}

into this


[ { Holiday_List_RecID: 1,
    Holiday_List_Name: 'Standard Holidays',
    Holiday_Date: '2016-12-26T05:00:00Z',
    Time_Start: null,
    Time_End: null,
    Description: 'Christmas Day',
    Last_Update_UTC: '2015-10-02T18:14:42Z',
    Updated_By: 'chigley',
    Time_Zone: 'Eastern Standard Time' },
  { Holiday_List_RecID: 1,
    Holiday_List_Name: 'Standard Holidays',
    Holiday_Date: '2016-12-23T05:00:00Z',
    Time_Start: null,
    Time_End: null,
    Description: 'Christmas Eve',
    Last_Update_UTC: '2015-10-02T18:14:32Z',
    Updated_By: 'chigley',
    Time_Zone: 'Eastern Standard Time' }]

install

npm install connectwise-manage-rest-api