Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Latest commit

 

History

History
58 lines (37 loc) · 1.79 KB

README.md

File metadata and controls

58 lines (37 loc) · 1.79 KB

connectwise-rest-api

nodejs module for interacting with Connectwise's REST API

npm npm version

Documentation: http://vc3.github.io/connectwise-rest-api

Install

$ npm install --save connectwise-rest-api

Typings

Typings are included in the package, however if you would like to install them seperatly you can.

$ typings install github:vc3/connectwise-rest-api/connectwise.d.ts -S --global

Usage

import { Connectwise } from 'connectwise-rest-api';

// The Connectwise is a wrapper class provides access to all the api endpoints and methods.
const connectwise: Connectwise = new Connectwise('connectwise url', 'company name', 'public api key', 'private api key');

// Check Connectwise's documentation for available conditions
const params: {  conditions?: string; orderBy?: string; page?: number; pageSize?: number; } = { your params };

connectwise.CompaniesApi.companyCompaniesGet(params).then( response => {
    console.log(response[0].name);
})

You can also import types or a specific api class

import { Ticket, TicketsApi } from 'connectwise-rest-api/release/api/api';

// Make sure you set your connectwise URL and Auth header

const authKey: string = new Buffer(`${company id}+${public api key}:${private api key}`).toString('base64');

const cwService: TicketsApi = new TicketsApi(`https://${connectwise url}/v4_6_release/apis/3.0`);

cwService.defaultHeaders = { 'Authorization': `Basic ${authKey}` };

cwService.serviceTicketsIdGet(12345).then( (response: Ticket) => {
    console.log(response);
});