I am a beginner programmer trying to form a URL to GET macy product information based on my keyword, here:http://developer.macys.com/docs/read/catalog_and_store_services/catalog/search#requesturl
They have 3 mandatory parameters, 2 of which is in the HTTP header, Accept
and x-macys-webservice-client-id
with another being in the query parameter, searchphrase.
According to the document, I have formed a jQuery function to GET products information:
function ajaxsearch(){
var terms = "reddress";
var macyurl = "https://api.macys.com/v4/catalog/search?searchphrase="+ terms;
alert(macyurl);
var apikey = "6zjre5gv8822t323e6wxj85a";
$.ajax({
url: macyurl,
headers:{
Accept: application/json,
x-macys-webservice-client-id: apikey
}
success: function(data){
alert("successful call!")
}
});
}
Question: Are the syntax of my function correct? I have checked this with the console and they are having problems with one of the headers, x-macys-webservice-client-id
. Is this the correctly way to set up HTTP header parameters in my case?