Connecting to LSW data in custom endpoint
Hello,
I'm creating an HTML custom endpoint. I need to call LSW system with the basic authorization using Ajax to get and parse the result so I can then query the right information. Can someone help point me in the right direction on how to do this?
I tried the below AJAX code,
$.ajax({
url: "https://test.response.lithium.com/api/reports/csv/conversation?xslt=json.xsl",
type: "GET",
data: {
startTime: '2013-01-20'
},
beforeSend: function (request)
{
request.withCredentials = true;
request.setRequestHeader("x-user", 'user')
request.setRequestHeader("x-pass", 'pass')
request.setRequestHeader("Authorization", "Basic XXXXXXXX");
},
crossDomain:true,
dataType:"jsonp",
success: function(res) {
alert("Success " + res);
},
error: function(err) {
alert("Error " + err);
}
});
but this always returns error message -
{"result":"fail","errorMessage":"Unauthorized"}
the username/password is already base64 encoded, and they are correct. but still get an unauthorized error. am i doing something wrong?
any help appreciated.
Thanks,
Shalini.