forked from acumenbrands/rest_suite
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
284 lines (187 loc) · 10.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Index</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Index</h1>
<h3> </h3>
<section>
<article><h1>rest_suite</h1>
<p>Server-side Javascript library that wraps parts of the Netsuite SuiteScript API (v2010.1). This
interface should be more performant than the SOAP based interface as it allows 50
simultaneous connections per set of login credentials. Note that NetSuite's point
system is seemingly arbitrary and we've tried to provide better error handling
wherever possible.</p>
<h2>Contributing to netsuite-rest-client</h2>
<p>rest_suite is built on vanilla JavaScript, using node and jasmine to provide a testing environment. We
suspect that NetSuite is using a version of Mozilla's JavaScript interpreter, but we can't be entirely sure.
This is the reason that we chose vanilla JavaScript over an alternative like CoffeeScript. Cross compliation
issues could be a nightmare as NetSuite is not to be trusted. Where possible, be explicit and direct with
your code.</p>
<h3>Getting Up and Running</h3>
<ul><li>Install node.js and npm</li><li>Run <code>./jspec</code></li></ul>
<h3>General Contribution Process</h3>
<ul><li>Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet</li><li>Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it</li><li>Fork the project</li><li>Start a feature/bugfix branch and commit atomically</li><li>Commit and push until you are happy with your contribution</li><li>Be sure to test your code and make sure that all tests pass before submitting a pullrequest.</li></ul>
<h2>Copyright</h2>
<p>Copyright (c) 2012 Acumen Brands, Inc. See LICENSE.txt for
further details.</p>
<h2>Usage</h2>
<p>Generally, each individual script is to be uploaded to NetSuite as a single endpoint with a single function being
exposed. These functions are documented throughout the project and should be relatively easy to ferret out.</p>
<h3>Uploading to NetSuite</h3>
<p>The process of deployment is a somewhat involved manual process at the moment. It is possible
to wrap all files into a zip and automate the process via a manifest, but this has not yet been
implemented. Many files contain multiple classes that would normally exist in their own files
specifically for this reason. The deploy process is painful enough as it is.</p>
<p>In the NetSuite web interface, go to the documents dropdown and select:</p>
<ul><li>Documents->Files->SuiteScripts</li></ul>
<p>Upload all .js files in lib here. Then proceed to the list of <code>Script</code> records. Create a new
Script record using each operation file. List netsuite_toolkit.js as an included library on each.
The script record also assigns each HTTP function to a provided function name. In each Script,
reference the appropriate post handler function in the "POST" text box. The function names should
be provided without parentheses: <code>deletePostHandler()</code> just becomes <code>deletePostHandler</code>.</p>
<p>From each Script record, generate a Script Deployment with an appropriate role/employee/account
access for the credentials your client will be using. NetSuite calculates these permissions
inclusively, so if one criteria out of any of them matches your credentials, it will provide access.</p>
<p>The Script Deployment will list the endpoint URL to which you will send requests with the JSON body
for the script's parameters.</p>
<h3>jspec</h3>
<p>We've added some handy tools in <code>jspec</code> to perform most of the mundane tasks associated with the project.
Here's a quick reference:</p>
<ul><li><code>./jspec</code> Set up your environment and run all tests</li><li><code>./jspec --doc</code> Generate HTML documentation in <code>doc/</code> with JSDoc3</li><li><code>./jspec --reset</code> Glear out installed node modules</li><li><code>./jspec --mono</code> Run tests without color</li><li><code>./jspec --debug</code> Fire up a node debugger with jasmine</li></ul>
<h2>Documentation</h2>
<p>HTML formatted documentation can be found in <code>doc</code>. This has been generated with JSDoc3 and
includes documentation provided by NetSuite for SuiteScript v2010.1 for easy reference. Documentation
is re-generated for each tagged release. If you'd like to generate docs on the fly, simply run <code>./jspec --doc</code></p>
<ul><li>Generally, anywhere you see <code>id</code> mentioed, it can safely be assumed to be <code>internal_id</code> in netsuite</li><li>Each script has one endpoint and only one endpoint. This is due to the nature of NetSuite's RESTlet interface.</li><li>Furthermore, each endpoint should respond to a POST request</li><li>All actions for a given endpoint are taken based on the request body of the POST</li></ul>
<h1>Basic Input Reference</h1>
<p>This is a basic overview of the JSON object payload for each request. A '+' next to a row
indicates an array; a '-' indicates a key in a hash.
## Initialize</p>
<h3>Description</h3>
<p>Initialize returns a blank record of the given type with all mandatory keys pre-populated with null or default values. This does not expose non-mandatory fields in the returned hash, those must be filled in manually client-side.</p>
<h3>Request Structure</h3>
<pre><code>-record_type</code></pre>
<h2>Load</h2>
<h3>Description</h3>
<p>Load will request a given record from the Netsuite database by internalid. It will return the
requested record will all mandatory and populated schema. Non-mandatory and custom fields with
blank values will not be populated in the returned hash.</p>
<h3>Request Structure</h3>
<pre><code>+ single record action
- id
- record_type</code></pre>
<h2>Delete</h2>
<h3>Description</h3>
<p>Delete will destroy records in Netsuite's database. If successful, the id of the removed record
will be returned. Otherwise, an exception will be raised.</p>
<h3>Request Structure</h3>
<pre><code>+ single record action
- id
- record_type</code></pre>
<h2>Upsert</h2>
<h3>Description</h3>
<p>Upsert requests a new records be written to the database or an existing record be altered.
If an internalid is present id the 'id' field, then it will attempt to update a record
loaded using the type and id, otherwise throwing an exception if it does not exists. If no
id is present, it will attempt to create a new record using the values given.</p>
<h3>Request Structure</h3>
<pre><code>+ single record action
- id
- record_type
+ literals
+ sublists
- name
+ line_items
+ create_or_update
- match_field
- literals
+ excise
- match_field (unique field to search against)
- value</code></pre>
<h2>Transform</h2>
<h3>Description</h3>
<p>Transform initializes a new transaction from another transaction record in a workflow. In this case
sublist items can be filtered (altered somewhat or removed if need be) but cannot be added if they
do not exist on the original transaction. A record is is mandatory for transform.</p>
<h3>Request Structure</h3>
<pre><code>+ single record action
- id
- source_type
- result_type
+ literals
+ sublists
- name
+ line_items
+ create_or_update
- match_field
- literals
+ excise
- match_field (unique field to search against)
- value</code></pre>
<h2>Saved Search</h2>
<h3>Description</h3>
<p>Saved search will request the results of an already created saved search from Netsuite. Results
<em>must</em> be sorted by internalid of the records returned in order to properly paginate the results.
This is a limitation of the SuiteScript environment that we have not yet found a workaround for.</p>
<h3>Request Structure</h3>
<pre><code>- record_type
- search_id
- lower_bound
- batch_size</code></pre>
<h2>Search (Ad-Hoc)</h2>
<h3>Description</h3>
<p>Search allows you to build a search on the fly. As with saved searches, results generally should
be filtered by internalid, however with ad-hoc search this is not mandatory. If another criteria
could reasonably be used to sort, the sort boolean is exposed for the client to use. If multiple
result columns have this set to true, only the last column in the list will be processed. A column
to sort by internalid is always added, so if no sort is provided the search will always be sorted
by internalid.</p>
<p>Formula filtering is also exposed and is a required alternative to explicit string matching in
RESTlet operation to avoid hitting the execution limit. It produces a SQL function that results
in 1 or 0. In the event a formula search is used, the name of the filter must be 'formulanumeric',
the value must be 'IS', and the value will be 1 or 0.</p>
<p>For the formula:
- name: The field on which the script is filtering
- values: An array of possible values, the comparison is
- comparison: A valid SQL comparison or equality operator
- join: 'AND' or 'OR' to join all comparisons of 'field' to a single value</p>
<h3>Request Structure</h3>
<pre><code>- record_type
- batch_size
- lower_bound
+ search_filters
- name
- operator
- value
- formula (optional)
- field
+ values
- comparison
- join
+ search_columns
- name
- join
- sort (boolean)</code></pre></article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Classes</h3><ul><li><a href="Deleter.html">Deleter</a></li><li><a href="DeleteRequest.html">DeleteRequest</a></li><li><a href="Initializer.html">Initializer</a></li><li><a href="Loader.html">Loader</a></li><li><a href="LoadRequest.html">LoadRequest</a></li><li><a href="NetsuiteToolkit.SublistProcessor.html">SublistProcessor</a></li><li><a href="SavedSearch.html">SavedSearch</a></li><li><a href="Searcher.html">Searcher</a></li><li><a href="Transformer.html">Transformer</a></li><li><a href="TransformRequest.html">TransformRequest</a></li><li><a href="Upserter.html">Upserter</a></li><li><a href="UpsertRequest.html">UpsertRequest</a></li></ul><h3>Namespaces</h3><ul><li><a href="global.html">global</a></li><li><a href="NetsuiteToolkit.html">NetsuiteToolkit</a></li><li><a href="NetsuiteToolkit.RecordProcessor.html">RecordProcessor</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.1.1</a> on Thu May 16 2013 11:16:10 GMT-0500 (CDT)
</footer>
<script> prettyPrint(); </script>
</body>
</html>