I am unable to authenticate the Gainsight APIs using SuiteScript in NetSuite.

I am unable to authenticate the Gainsight APIs using SuiteScript in NetSuite. The issue is probably in the request header as I am using the same header in other coding languages and authenticating successfully even through the POSTMAN application I am able to authenticate. I tried a lot in suiteScript but each time the authentication got failed can anyone please help me with this?

Please find the document:


Rookie Asked on September 23, 2022 in SuiteScript.

Similar Issue (respone.code is 406 via RESTLet). I am sending a third pary POST request to SharpSpring. I have successfully sent request with 200 response via PostMan and PHP script on a mini test webserver. For some reason RESTLet https.post does not want to return the results. My Headers, body and URL are transcribed exactly to NS SuiteScript.

I have been storing my headers as such:
let headerL = [ {“Content-Type”: “application/json”}, {“Accept-Post”: “*/*”}, … etc …];


//Third Party body syntax (again, successful outside of NS RESTLet)

let reqBody = {
“method”: “getLeads”,
“params”: {“where”: {}},
“id”: “9999”


Finally the actual request:
let resp=https.request({
method : https.Method.POST,
url: urlSS,
header: headerL,
body: JSON.stringify(reqBody)

resp.code returns 406. I have also tried https.post with simalar results and several permutations of the same thing.

This is a rough one and not sure where the failure is at.

Overall, I’m fairly certain that NS has an issue with the headers but unable to confirm.

Will someone kindly assist on any issues or syntax or similar experience and troubleshooting solution?

on December 1, 2022.
Add Comment
1 Answer(s)

I have had this same issue with this for a long time. My HTTP requests worked everywhere EXCEPT NetSuite http and https requests.
I added this {“Accept”: “*/*”} to headers and it worked.


let headerL={
"Accept": "*/*",
"AnotherHTTPheaderKey": "AnotherHTTPheaderValue"   //ignore this one
let resp=https.post({
url: "www.google.com",
body: JSON.stringify(someJSONobject),
headers: headerL

Hope this helps

Rookie Answered on December 2, 2022.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.
  • This site made possible by our sponsors:   Tipalti   Celigo   Become a Sponsor   Become a Sponsor