Skip to content

Instantly share code, notes, and snippets.

@ryanwebjackson
Created June 12, 2017 03:38
Show Gist options
  • Save ryanwebjackson/9e2b76fb98985b6f288a4c26360dfb8c to your computer and use it in GitHub Desktop.
Save ryanwebjackson/9e2b76fb98985b6f288a4c26360dfb8c to your computer and use it in GitHub Desktop.
'use strict';
var express = require('express');
var router = express.Router();
var ConnectWiseRest = require('connectwise-rest');
router.get('/cwapi', function (req, res) {
//debugger;
//var cw = new ConnectWiseRest({
// companyId: 'company',
// companyUrl: 'support.cit-net.com',
// publicKey: 'dDLBNoxHhpwabKut',
// privateKey: 'mNVPgd3XOa3chItM',
// 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
// }
//});
//var api = cw.API.api; //DEBUG
//debugger;
//console.log('cw api: ', api);
var responseBody = 'made it here';
//cw.ServiceDeskAPI.Tickets.getTicketById(1) //*Arbitrary value - might not exist*
// .then(function (result) {
// //do something with results
// console.log('result: ', result);
// responseBody = result;
// })
// .catch(function (error) {
// //handle errors
// console.log('error: ', error);
// responseBody = error;
// });
res.send('Response: ' + responseBody);
});
module.exports = router;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment