@twec/netsuite-client
v2.0.0
Published
Generic functionality for connecting to NetSuite Web Services from Node
Downloads
8
Readme
Netsuite-Client
(Node + NetSuite)
This package contains functionality for connecting to NetSuite Web Services from Node, handling token authorization and SOAP XML parsing, and allows fetching records and uploading files.
Install
npm install @twec/netsuite-client
Use in your node app
Import
const NetSuiteClient = require('netsuite-client');
// or: import NetSuiteClient from 'netsuite-client';
Instantiate
When instatiating your netsuite object, you'll need to provide a config object with connection details. See netsuite-config-template.json.
const netSuiteConfig = {
// various properties
// see netsuite-config-template.json
// or the defaultConfig in netsuite-client.js
};
const netsuiteClient = new NetSuiteClient(netsuiteConfig);
Get a record
const record = await netsuiteClient.get({
// Specify one or more of these properties
type: '',
internalId: '',
externalId: ''
});
Upload a file
const fileRef = await netsuiteClient.upload(
'./some/local/dir/my-file.csv', // local file
'uploads/my-file.csv', // NetSuite target file path
);
Other
Checkout other methods: look at the netsuite object console.log(netsuiteClient);
and read netsuite-client.js.
Limitations
Currently you can only fetch records (get
operation), upload a file (upsert
operation), and fetch folders.
Testing
- Create a
netsuite-config.json
file; seenetsuite-config-template.json
for an example in the Functional test folder. - Run
yarn run test
to execute the test scripts.