Coder Social home page Coder Social logo

bang-netsuite's Introduction

bang-netsuite

A set of NetSuite RESTlets and a REST client for interacting with them.

All RESTlets are designed to be used by bang.

Install

npm install --save rbwsam/bang-netsuite
  1. Login to your NetSuite account
  2. Upload the files in ./restlets
  3. Create and deploy RESTlet scripts for each file
  4. Update SCRIPT and DEPLOY for each class in ./lib/resources

Examples

The client

var NetSuite = require('bang-netsuite');

var ns = new NetSuite({
  email: 'YOUR NS EMAIL',
  password: 'YOUR NS PASSWORD',
  company: 'YOUR NS COMPANY ID'
});

Customers

// Find customer
ns.Customers.find(42).then(function(result) {
  console.log(result); The customer
}, function(err) {
  console.log(err);
});

// Create a customer
var han = { firstname: 'Han', lastname: 'Solo' }

ns.Customers.create(han).then(function(result) {
  console.log(result); // The persisted customer
}, function(err) {
  console.log(err);
});

Inventory Items

// Get all Inventory Items (API limited to 1000)
ns.InventoryItems.find().then(function(result) {
  console.log(result); // Array of inventory items
}, function(err) {
  console.log(err);
});

Sales Orders

// Create a Sales Order
var salesOrder = {
  customerId: 42,
  items: [
    {
      id: 99,
      quantity: 1,
      amount: 1.99 // The total (quantity * item price)
    },
    {
      id: 203,
      quantity: 3,
      amount: 5.97 // The total (quantity * item price)
    }
  ]
};

ns.SalesOrders.create(salesOrder).then(function(result) {
  console.log(result); // The persisted sales order
}, function(err) {
  console.log(err);
});

Test

npm test

bang-netsuite's People

Contributors

rbwsam avatar

Watchers

James Cloos avatar MUHAMMAD MUBUSHER ASLAM avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.