I'm trying to develop in NetSuite a simple form portlet submitting to a RESTlet in the back end. Here's my form portlet:
function workManagerPortlet(portlet, column) {
portlet.setTitle('Portlet');
portlet.addField(....)
// INSERT HERE ALL THE FORM FIELDS
portlet.setSubmitButton(nlapiResolveURL('RESTLET', 'customscript_gw_ss_form_backend', 'customdeploy_wm_form_backend', true), 'Submit', '_hidden');
}
When I click on submit I can see in Chrome's developer console the status is 206 Partial Content, but the record I'm submitting is not being stored in the database and in the console there's no response for this request.
Therefore, I decided to investigate the connection to the RESTlet. My problem is that I cannot get past the RESTlet authentication. Here are my NLAuth headers:
User-Agent: SuiteScript-Call
Authorization: NLAuth
nlauth_account: TSTDRV1291212
nlauth_email: $email
nlauth_signature: $password
nlauth_role: administrator
Content-Type: application/json
Obviously, replacing '$email' and '$password' for the corresponding values.
The 'nlauth_role' value is the role id in Netsuite.
I'm using Postman to test this and I always get a "401 Authorization Required" status and the following error.
{
"error":
{
"code": "USER_ERROR",
"message": "header is not NLAuth scheme [ NLAuth ]"
}
}
Any ideas about what I'm doing wrong?
I'm trying to develop in NetSuite a simple form portlet submitting to a RESTlet in the back end. Here's my form portlet:
function workManagerPortlet(portlet, column) {
portlet.setTitle('Portlet');
portlet.addField(....)
// INSERT HERE ALL THE FORM FIELDS
portlet.setSubmitButton(nlapiResolveURL('RESTLET', 'customscript_gw_ss_form_backend', 'customdeploy_wm_form_backend', true), 'Submit', '_hidden');
}
When I click on submit I can see in Chrome's developer console the status is 206 Partial Content, but the record I'm submitting is not being stored in the database and in the console there's no response for this request.
Therefore, I decided to investigate the connection to the RESTlet. My problem is that I cannot get past the RESTlet authentication. Here are my NLAuth headers:
User-Agent: SuiteScript-Call
Authorization: NLAuth
nlauth_account: TSTDRV1291212
nlauth_email: $email
nlauth_signature: $password
nlauth_role: administrator
Content-Type: application/json
Obviously, replacing '$email' and '$password' for the corresponding values.
The 'nlauth_role' value is the role id in Netsuite.
I'm using Postman to test this and I always get a "401 Authorization Required" status and the following error.
{
"error":
{
"code": "USER_ERROR",
"message": "header is not NLAuth scheme [ NLAuth ]"
}
}
Any ideas about what I'm doing wrong?
Share Improve this question edited Sep 11, 2020 at 22:41 quarks 35.4k82 gold badges308 silver badges546 bronze badges asked Jun 8, 2015 at 8:45 MichoMicho 3,96313 gold badges39 silver badges41 bronze badges 4-
2
nlauth values should be ma separated like this
NLAuth nlauth_account: TSTDRV1291212, nlauth_email: $email, nlauth_signature: $password, nlauth_role: administrator
. – Zain Shaikh Commented Jun 8, 2015 at 10:05 -
2
one more thing, trying sending
3
instead ofadministrator
. It's role id actually which is required by NetSuite. – Zain Shaikh Commented Jun 8, 2015 at 10:06 -
1
Thank you @ZainShaikh for pointing me in the right direction. I fixed it using the headers
Authorization: NLAuth nlauth_account=TSTDRV1291212, nlauth_email=$email, nlauth_signature=$password, nlauth_role=3
– Micho Commented Jun 9, 2015 at 1:34 - 1 that's good. let me post it as answer, so you could accept it as answered :) – Zain Shaikh Commented Jun 9, 2015 at 10:49
1 Answer
Reset to default 7nlauth values should be ma separated like this:
NLAuth nlauth_account: TSTDRV1291212, nlauth_email: $email, nlauth_signature: $password, nlauth_role: administrator`
One more thing, trying sending 3
instead of administrator
. It's role id actually which is required by NetSuite.