1.0.0 • Published 3 years ago
ts-restlet v1.0.0
TS-RESTlet
Connect to a NetSuite restlet through Token Based Authentication
Install
npm install ts-restlet
Setup
import * as dotenv from 'dotenv';
dotenv.config();
import { RESTlet } from './src/index'
var restlet = new RESTlet({
accountId: process.env.NS_ACCOUNT_ID,
tokenKey: process.env.NS_TOKEN_KEY,
tokenSecret: process.env.NS_TOKEN_SECRET,
consumerKey: process.env.NS_CONSUMER_KEY,
consumerSecret: process.env.NS_CONSUMER_SECRET,
url: process.env.NS_URL,
})
restlet.get({invoice: '1'})
.then(function(response) {
console.log(response)
}).catch(function(error) {
console.error(error)
})
restlet.post(
{
create: {
type: 'salesorder',
data: 'some data...'
}
})
.then(function(response) {
console.log(response)
}).catch(function(error) {
console.error(error)
})
1.0.0
3 years ago