Hi Everyone, I'm having an issue where I'm unable ...
# suitescript
b
Hi Everyone, I'm having an issue where I'm unable to successfully make a request to a third party api using
nlapiRequestURL
while the same request works fine using the
n/https
module as well as if i do it in the console using jQuery.ajax. Does anyone know if there is some difference between the nlapiRequestURL and n/https requests that happens in the background that would be causing this to fail? For reference these are what each of my requests look like, and in each of their scripts I have the url and headers variables exactly the same
Copy code
var response = nlapiRequestURL(url, {}, headers, 'POST');
          var response = https.request({
                          method: <http://https.Method.POST|https.Method.POST>,
                          url: url,
                          headers: headers
                         });
b
you should probably do an empty object for the request body as well
netsuite treats the body differently depending on if you pass an object vs a string
b
with or without the body, the https.request works fine.. its the nlapiRequest that is having the issue, empty object, string, empty string, dummy data all do not work
b
if you want to debug, send the request to an echo service like httpbin.org
compare the response you receive from each
b
good idea thank you!