@k5tech/opentrack
v0.2.4
Published
OpenTrack API Wrapper
Downloads
21
Readme
OpenTrack API Wrapper
Installation
npm install --save @k5tech/opentrack
Example
// import { OpenTrackCustomerAPI } from '@k5tech/opentrack';
const { OpenTrackCustomerAPI } = require('@k5tech/opentrack');
const username = 'username'
const password = 'password'
const enterpriseCode = 'ZE';
const companyNumber = 'ZE7';
const serverName = 'arkonap.arkona.com'
const customerNumber = '1039358';
const api = (await OpenTrackCustomerAPI.create())
.authenticatedAs(username, password)
.dealer(enterpriseCode, companyNumber, serverName);
const apiResponse = await api.customerLookup({ CustomerNumber: customerNumber });
console.log(apiResponse);
API Modules
Customer
Customer Search
// import { OpenTrackCustomerAPI } from '@k5tech/opentrack';
const { OpenTrackCustomerAPI } = require('@k5tech/opentrack');
const username = 'username'
const password = 'password'
const enterpriseCode = 'ZE';
const companyNumber = 'ZE7';
const serverName = 'arkonap.arkona.com'
const phoneNumber = '5558369361';
const api = (await OpenTrackCustomerAPI.create())
.authenticatedAs(username, password)
.dealer(enterpriseCode, companyNumber, serverName);
const apiResponse = await api.customerSearch({Phone: phoneNumber});
console.log(apiResponse);
Customer Lookup
// import { OpenTrackCustomerAPI } from '@k5tech/opentrack';
const { OpenTrackCustomerAPI } = require('@k5tech/opentrack');
const username = 'username'
const password = 'password'
const enterpriseCode = 'ZE';
const companyNumber = 'ZE7';
const serverName = 'arkonap.arkona.com'
const customerNumber = '1039358';
const api = (await OpenTrackCustomerAPI.create())
.authenticatedAs(username, password)
.dealer(enterpriseCode, companyNumber, serverName);
const apiResponse = await api.customerLookup({ CustomerNumber: customerNumber });
console.log(apiResponse);
Service
Open Repair Order Lookup
// import { OpenTrackCustomerAPI } from '@k5tech/opentrack';
const { OpenTrackServiceAPI } = require('@k5tech/opentrack');
const username = 'username'
const password = 'password'
const enterpriseCode = 'ZE';
const companyNumber = 'ZE7';
const serverName = 'arkonap.arkona.com'
const now = new Date('2017-11-08T22:02:51.000Z');
const start = new Date(now);
const end = new Date(now);
start.setDate(start.getDate() - 1);
end.setDate(end.getDate() + 1);
const api = (await OpenTrackServiceAPI.create())
.authenticatedAs(username, password)
.dealer(enterpriseCode, companyNumber, serverName);
const apiResponse = await api.openRepairOrderLookup({
CreatedDateTimeEnd: end.toISOString(),
CreatedDateTimeStart: start.toISOString(),
InternalOnly: 'Y',
});
console.log(apiResponse);
Get Closed Repair Orders
// import { OpenTrackServiceAPI } from '@k5tech/opentrack';
const { OpenTrackServiceAPI } = require('@k5tech/opentrack');
const username = 'username'
const password = 'password'
const enterpriseCode = 'ZE';
const companyNumber = 'ZE7';
const serverName = 'arkonap.arkona.com'
const api = (await OpenTrackServiceAPI.create())
.authenticatedAs(username, password)
.dealer(enterpriseCode, companyNumber, serverName);
const apiResponse = await api.getClosedRepairOrders({CustomerNumber: '1039974'});
console.log(apiResponse);