186
rated 0 times
[
191]
[
5]
/ answers: 1 / hits: 18273
/ 8 Years ago, thu, june 30, 2016, 12:00:00
I'm trying to get some datas from an external API (from Mashape) that requires a specific header to set the API key.
Everything is ok using jQuery :
$.ajax({
url: 'https://omgvamp-hearthstone-v1.p.mashape.com/cardbacks',
type: 'GET',
data: {},
dataType: 'json',
success: function(data) { console.dir((data.source)); },
error: function(err) { alert(err); },
beforeSend: function(xhr) {
xhr.setRequestHeader(X-Mashape-Authorization, MY_API_KEY);
}
});
However, when I'm trying to do the same request with axios for a react application, I have a 404 error:
axios.get({
url: 'https://omgvamp-hearthstone-v1.p.mashape.com/cardbacks',
headers: {
X-Mashape-Authorization: MY_API_KEY
}
})
Is there something I'm missing ? Thanks.
More From » api