Discussions
Read on for the latest updates including:
• Agenda Builder launch
• SuiteWorld On Air registration
• New NetSuite Prompt Studio Contest
• And more!
Check out this thread to learn more!
Don’t miss your chance to meet our SuiteGurus—NetSuite Support professionals and subject matter experts with extensive experience in select product areas, including OneWorld, Advanced & Basic Accounting, Supply Chain Management, Receivables & Payables, CRM, Account Administration, and the SuiteCloud Platform. Full Conference attendees can prebook exclusive 30-minute one-on-one sessions for your product questions.
Spots are limited! Register through your Agenda Builder and find SuiteGuru under Agenda Enhancements.
RESTlet POST JSON Parameter
Hi,
I have a restlet that I want to POST to. Here is what I am entering into the developer console in my chrome browser:
function replacer(key, value) {
if (typeof value === 'number' && !isFinite(value)) {
return String(value);
}
return value;
}
var headers = new Array();
headers['User-Agent-x'] = 'SuiteScript-Call';
headers['Content-Type'] = 'application/json';
var requestData = { "api":"label" };
nlapiRequestURL('/app/site/hosting/restlet.nl?script=239&deploy=1', JSON.stringify(requestData, replacer), headers);
In the restlet code:
function post(dataIn)
{
var logger = new Logger();
logger.enableDebug();
logger.debug('post','Post: api=' + dataIn);
}
This outputs to the log: "Post: api={"api":"label"}". That tells me that the request data is being passed as a string NOT as a JSON object. As you can see I am setting the "application/json" content type. But It still will not post as an object so I can't access the data on the restlet, ie: dataIn.api returns NULL because it's a string.