Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including connectwise-action-api with all npm packages installed. Try it out:

var connectwiseActionApi = require("connectwise-action-api")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

connectwise-action-api v1.1.1

A thin high performance JavaScript layer for the ConnectWise XML Action API designed for Node.js.

connectwise-action-api

A thin high performance JavaScript layer for the ConnectWise XML Action API designed for Node.js.

buffered usage

Buffer results and return with callback api. Optimized for smaller result sets. Entire response is buffered, then parsed into a JavaScript object.

var cw = require('connectwise-action-api').configure(
    'SERVER HOST NAME',
    'COMPANY NAME',
    'INTEGRATOR LOGIN ID',
    'INTEGRATOR PASSWORD'
);

cw.action('GetTicketAction', {
    SrServiceRecid: 12345
}, function (error, result) {
    error && console.error(error);
    if (result) {
        var ticket = result.GetTicketAction.Ticket;
        console.dir(ticket);
    }
});

streaming usage

Stream results using event emitter api. Optimized for large result sets. Uses less memory. Matches can be processed immediately and asynchronously. No need to depend on server paging. Fewer server round trips. Each xPath match is parsed into a JavaScript object and emitted as an event.

var cw = require('connectwise-action-api').configure(
    'SERVER HOST NAME',
    'COMPANY NAME',
    'INTEGRATOR LOGIN ID',
    'INTEGRATOR PASSWORD'
);

cw.actionStream('RunReportQueryAction', '//Result', {
        ReportName: 'Schedule',
        Limit: 100000
    })
    .on('match', function (match) {
        console.dir(match);
    })
    .on('error', function (error) {
        console.error(error);
    })
    .on('end', function () {
        // all done
    });

tests

See tests directory for documentation and examples of API actions. Tests clean up after themselves.

  • Configure tests in test-config.js
  • Run all tests: node test
  • Run specific tests using file name pattern: node test version
d:\connectwise-action-api>node test version

get-connectwise-version.js
{ Version: 'v2014.4.23325', IsCloud: 'false' }
✔ get_connectwise_version

OK: 2 assertions (729ms)
  • Clean up after tests: npm run clean

install

npm install --save connectwise-action-api

docs

available reports and fields

ideas

  • make it work with Node.js and Browser
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free