Note that there are some explanatory texts on larger screens.

plurals
  1. POErrors when trying NetSuite's Restlet interface: datain is null
    text
    copied!<p>I'm trying out Restlets for the first time and I am having trouble returning any data.</p> <p>I've built a basic restlet and deployed it in NetSuite. The code is as follows:</p> <pre><code>function getRESTlet(dataIn) { return nlapiLoadRecord(dataIn.recordtype, dataIn.id); // e.g recordtype="customer", id="769" } </code></pre> <p>Using Chromes' REST Console application I've set up the following:</p> <pre><code>Request URI: https://rest.netsuite.com/app/site/hosting/restlet.nl?script=123&amp;deploy=1&amp;recordtype=customer&amp;id=2409 Request Headers: NLAuth nlauth_account=123456,nlauth_email=email@emailaddy.com,nlauth_signature=password </code></pre> <p>Running it as a <code>GET</code> operation I return the following error:</p> <pre><code>error code: JS_EXCEPTION error message:type </code></pre> <p>Followed by the following email:</p> <pre><code>Date &amp; Time: 8/19/2013 2:48 pm Execution Time: 0.06s Script Usage: 0 Script: getRecord Type: RESTlet Function: getRESTlet Error: SSS_MISSING_REQD_ARGUMENT type Stack Trace: getRESTlet(getCustomer.js:14) restletwrapper(null$lib:3) </code></pre> <p>The customer record exists, the RestLet code is from the NetSuite help system, and I get an error email when the script fails so I know the deployment URL is good. </p> <p>Any ideas on what I'm doing wrong? </p> <p>--EDIT--</p> <p>Changing my function signature to <code>function getRESTlet(type,dataIn)</code> resolves the type error, although now I get: </p> <pre><code>error code: UNEXPECTED_ERROR error message:TypeError: Cannot read property "recordtype" from undefined (getCustomer.js#14) </code></pre> <p>I've also removed <code>customer</code> and <code>id</code> from the <code>request URI</code> and instead listed them in the <code>Request Payload</code> section of REST Console. </p> <p>--Edit 2--</p> <p>adding <code>nlapiLogExecution('DEBUG', 'JSON.stringify(datain) is:', JSON.stringify(datain));</code> to the function is returning blank for the log entry. It appears that datain is null....</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload