Beginner Documentation - acumenbrands/netsuite-rest-client GitHub Wiki

This is a great little rest client! I'm not a ruby native, so things took awhile for me to figure out. I thought I'd add some info on how to install and configure the client.

Installation: This is specific to debian-based linux distributions.

##Dependencies: ruby-rest-client

ruby-json

ruby

git-core

rake

rubygems

To install the dependencies:

sudo apt-get install ruby ruby-json ruby-rest-client git-core rake rubygems

Git the code:

git clone https://github.com/acumenbrands/netsuite-rest-client.git

Ruby gem installation:

cd netsuite-rest-client

gem build netsuite-rest-client.gemspec

sudo gem install netsuite-rest-client

##The Netsuite Part: If you need clarification on anything, please check the Netsuite support documentation and install one of their example restlets.

  1. You will have a folder called netsuite-rest-client, change into this directory.
  2. In the "restlets" folder, you will find "rest.js"
  3. In Netsuite: Setup -> Customization -> Scripts -> New
  4. Choose RESTlet and give your restlet a name.
  5. Under the SCRIPTS tab, set the GET Function to "getHandler"
  6. Set the POST Function to "postHandler"
  7. Select "Save and Deploy"
  8. Check your URL, you should find the id of this script there.
  9. Edit lib/netsuite-rest-client.rb and change DEFAULT_SCRIPT_ID to the id you found in step 8.

##Testing

You should be in netsuite-rest-client/lib. Create a file here called 'test.rb' with these contents:

#!/usr/bin/env ruby
require 'pp'
require 'netsuite-rest-client'
require 'uri'

connection =    Netsuite::Client.new('NETSUITE_ACCOUNT_NUMBER','EMAIL_ADDRESS',URI.escape("PASSWORD"),'ROLE_ID')
pp connection.get_record('InventoryItem','INTERNAL_ID_OF_INVENTORY_ITEM')

##Execute the code ruby test.rb

This should print just about everything about the item! Everything in caps should be replaced with your specific credentials. Note that the default 'Administrator' role has an id of '3'(mileage may vary?). To find the id of an item, just pull up any inventory item in netsuite and look at the url.

I hope someone finds this useful. Thanks to the folks at acumenbrands for sharing this!

-braubot