Discussions
Join us for complimentary one-day events around the world and step into a future fueled by AI and limitless potential. Explore new breakthroughs, sharpen your skills, and connect with experts who are shaping what’s next. Experience bold keynotes, interactive learning, and connections that span the global NetSuite community. Discover what's next at SuiteConnect Tour 2026.
nlapiRequestURL PDF download - Unexpected error
Hi,
I am trying to download 2 PDF files from RESTLet code - both from different hosts/urls. Once succeeds, the other fails with an "unexpected error" when nlapiReuqestURL is called.
The calling code is the same, just the URL differs:
// Setting up Headers
var headers = new Array();
headers['Accept'] = 'application/json'; // must be json (null or pdf returns "not acceptable" from the server side)
headers['Content-Type'] = 'application/json';
headers['Authorization'] = 'Bearer ' + access_token;
headers['client_id'] = client_id;
// Submit Request - Throws "Unexpected Error"
var response = nlapiRequestURL( encodeURI(myURL), null, headers );
NOTE: The token code works fine for simple API endpoints that return JSON. It;s only when I ask for a PDF file that it filas so it's not that.