i am trying to add customer via prestashop webservice . but it is giving me error as 401 unautorised. Please help me if i have missed out something in below code
Note: i m just passing xml value as test just to check whether it works or not.
$.ajax({
type:"POST",
url: "http://127.0.0.1/ebooks/api/customers/",
contenttype:"application/xml",
datatype:"xml",
data:{
PHP_AUTH_USER:"",
ws_key:"XGX2VQ1IRLVF1H7F4Z8LTZR976PZSASDCF7R",
xml:"test"},
success: function(text) {
alert(getXmlAsString(text));
$("#bid1").text(text);
},
error: function(xhr) {
//something went wrong, handle the error and display a message
alert("An error occured: " + xhr.status + " " + xhr.statusText);
}
});