w3bguy
w3bguy

Reputation: 2250

ZenDesk API Call From NetSuite Not Working

I'm trying to send data from NetSuite to ZenDesk via the ZenDesk API. Problem is, I can not get it to authenticate by placing the authentication inside the header. Has anyone seen any articles on doing it this way? I've tried adding it as {email}:{password} and {email}/token:{token} with no luck.

I have tested the password and the token using curl. So I do know that the password is correct. Any thoughts on this one?

I've also tried using Postman to create the authentication and it worked as well. Oddly enough, though, I can not use that authentication in any other application. I can paste is into the header (in Postman) with no issues, but when I try to do that via Advanced Rest Client (Chrome Extension) it won't work, nor will it work in the header from NetSuite.

I'm guessing there must be something that I am missing that Postman is doing by itself.

Upvotes: 0

Views: 507

Answers (1)

bknights
bknights

Reputation: 15402

generally you have to provide credentials as a header e.g. a GET request like:

var url = 'https://...';
var cred = 'username' +':'+ 'password';
var headers = {
    'Content-Type' : 'application/json',
    'Authorization' : nlapiEncrypt(cred, 'base64');
};
nlapiRequestURL(url, null, headers); 

Netsuite has a new method that apparently helps with this: nlapiRequestURLWithCredentials but I've not bothered figuring it out since the above is well tested and has worked with multiple remote systems.

Upvotes: 2

Related Questions