1
votes

I am Trying to call External URL From Suitelet its throwing 406 Error.

var user_name = ‘username’;
var password = ‘password’;
var url=”Url”;
var auth = nlapiEncrypt(user_name+’:’+password,’base64′);

var headers = new Array();
headers[“Content-Type”] = “application/json”;
headers[“Authorization”] = ‘Basic ‘+auth+”;
headers[“Token”] = ‘abcdddd-djfjjff-djd/dkdkd’;

var token_res=nlapiRequestURL(url, null,headers);
var token_response_XML = token_res.getBody();
nlapiLogExecution(‘DEBUG’, ‘token_response_XML’, token_response_XML);

Anyone Suggest Please?

Thanks in Advance

1

1 Answers

0
votes

Based on a quick Google search (it's been a LONG time since I've seen that error code), it looks like your other system is not returning the data in the manner that is expected. I would suggest testing with something like the chrome ARC (Advanced REST Client) extension so that you can see the entire process and get it all perfected. Here is the page I read up on 406 errors to refresh my memory.

406 Not Acceptable