Netsuite Tragic
11/29/2021, 12:19 AMcode: 38191,
title: "Invalid HTTP header",
detail: "Missing or invalid format for mandatory Authorization header"
My code looks like:
var header = {
'Authorization' : 'Bearer '+sessionToken,
'Host' : '<http://test.api.amadeus.com|test.api.amadeus.com>',
'Content-type' :'application/json',
'Accept-Encoding' :'gzip',
'Content-Length' : '12'
}
var response =https.get({
url : url,
header : header
});
I am successfully obtain the token in earlier code. I can also successfully use the URL and tokenbattk
11/29/2021, 12:23 AMbattk
11/29/2021, 12:23 AMbattk
11/29/2021, 12:25 AMbattk
11/29/2021, 12:25 AMbattk
11/29/2021, 12:25 AMNetsuite Tragic
11/29/2021, 12:26 AMbattk
11/29/2021, 12:27 AMbattk
11/29/2021, 12:27 AMNetsuite Tragic
11/29/2021, 12:27 AMbattk
11/29/2021, 12:27 AMbattk
11/29/2021, 12:28 AMbattk
11/29/2021, 12:29 AMNetsuite Tragic
11/29/2021, 12:29 AMNetsuite Tragic
11/29/2021, 12:33 AMNetsuite Tragic
11/29/2021, 12:33 AM{
headers: {
Accept: "text/*",
"Accept-Encoding": "gzip, deflate",
Host: "<http://httpbin.org|httpbin.org>",
"User-Agent": "NetSuite/2021.2 (SuiteScript)",
"X-Amzn-Trace-Id": "Root=1-61a41f80-3873b18167aecc480d8ec59a"
}
}
battk
11/29/2021, 12:34 AMbattk
11/29/2021, 12:35 AMbattk
11/29/2021, 12:35 AMNetsuite Tragic
11/29/2021, 12:35 AMNetsuite Tragic
11/29/2021, 12:38 AMsuiteExperimenter
11/30/2021, 4:12 PMNetsuite Tragic
11/30/2021, 9:02 PMvar tokenURL = amedeusURL+'v1/security/oauth2/token';
var tokenBody = {
grant_type : 'client_credentials',
client_id : clientId,
client_secret : clientSecret
};
var tokenHeader = {};
var token = <http://https.post|https.post>({
url : tokenURL,
body : tokenBody,
headers : tokenHeader
});
var sessionToken = JSON.parse(token.body).access_token;
suiteExperimenter
12/01/2021, 12:15 AM