Coder Social home page Coder Social logo

mubusher / netsuite-generic-restlet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vinikira/netsuite-generic-restlet

0.0 2.0 0.0 15 KB

Generic restlet for netsuite that allow work with records like SuiteTalk, but using JSON.

License: MIT License

JavaScript 100.00%

netsuite-generic-restlet's Introduction

netsuite-generic-restlet

Generic restlet for netsuite that allow work with records like SuiteTalk, but using JSON.

Quick Start

First, you will need Ramda.js, after download ramda.min.js, put it in the source folder. Upload the src files to File Cabinet, then create and implement a RESTlet script.

Features

Create record

Sending a HTTP POST request to the restlet with this sample payload:

{
  "type": "invoice",
  "isDynamic": false,
  "columns": {
      "customer": "14"
  },
  "lines": [
      {
          "sublistId": "item",
          "lineItems": [
              {
                  "item": 1,
                  "amount": 14.0
              },
              {
                 "item": 2,
                 "amount": 16.0
              }
          ]
      }
  ],
  "options": {
      "ignoreMandatoryFields": false
  }
}

Lookup/Search record

Using HTTP GET request, you can create searches, load searches and lookup records:

To create a search, you must send the following parameters (query string):

  • type - the record type
  • filters - filters are separated by semicolons (to name, operator and value) and then by comma. Formulas are not supported yet. To join tables, use dot separator (eg. customer.name)
  • columns - columns are separated by comma. Formulas are not supported yet. To join, use dot separator (eg. customer.name)

Example:

curl -XGET https://your-url-reslet?type=invoice&filters=date;within;01/01/2018;05/02/2018,entity.name;is;Foo&columns=amount,trandate

To load a search you must send the following parameters:

  • searchId - the id of saved search in NetSuite

Example:

curl -XGET https://your-url-reslet?searchId=your-search-id

To lookup record fields, you must send the following parameters:

  • type - record type
  • recordId - record id
  • columns - columns separated by comma. To join, use dot separator (eg. customer.name)

Example:

curl -XGET https://your-url-reslet?type=customer&recordId=15&columns=companyname,phone

All search options accepts pagination and sort columns, just use the following parameters:

  • page - page number
  • sortdir - sort direction (ASC|DESC|NONE)
  • sortcol - column number to be sorted (begin with 0)

All GET request can be cached, just use the following parameters:

  • cache - Cache name and key (separated by dot)

Update record

Send a HTTP PUT request to the restlet with this sample payload:

{
  "type": "invoice",
  "recordId": 14,
  "values": {
  	"trandate": "01/03/2018"
  },
  "options":{
	"isDynamic": false
   }
}

Update lines is not supported yet.

Delete record

Send a delete request to delete a record, following the parameters:

curl -XGET https://your-url-reslet?type=customer&recordId=15

Tests

In test folder has a .https file that allows you to use the restclient (for emacs) to make requests tests.

netsuite-generic-restlet's People

Contributors

aonic avatar vinikira avatar

Watchers

 avatar  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.