I'm trying to make a GET request through jQuery to the Mailchimp API. It seems though my custom header is not correctly set as I get a Your request did not include an API key.
error.
It works fine if I make the request using curl on my Ubuntu machine:
curl --header "Authorization: apikey 709XXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us11" https://us11.api.mailchimp.com/3.0/campaigns
Here's my code:
$.ajax({
type: 'GET',
url: 'https://us11.api.mailchimp.com/3.0/campaigns',
crossDomain: true,
dataType: 'jsonp',
contentType: "application/json; charset=utf-8",
headers: {
'Authorization': 'apikey 709XXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us11'
}
}).done(function (response) {
console.log(response); // verbose
});
I even tried adding this above:
$.ajaxSetup({
headers: { 'Authorization': 'apikey 709XXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us11' }
});
You need to add the key via Basic Auth like and as far I am aware off, You can't query it from front-end, it must be on the back-end.
Find an example in NodeJS:
headers: {
'Authorization': 'Basic ' + new Buffer(`anything:${MailChimpKey}`).toString('base64');
}
I see a strange behavior when redirecting to a URL with Backbone router. If I try to redirect to: //myserver/component_issues/index?id=org.codehaus.sonar:sonarqube ... everything is fine, but I get ...
I see a strange behavior when redirecting to a URL with Backbone router. If I try to redirect to: //myserver/component_issues/index?id=org.codehaus.sonar:sonarqube ... everything is fine, but I get ...
I want to return data from a Service function and inject it into a controller via the routeProvider, but only once the data has been fully loaded. app.js: .when('/sources', { templateUrl:...
I want to return data from a Service function and inject it into a controller via the routeProvider, but only once the data has been fully loaded. app.js: .when('/sources', { templateUrl:...
The code snippet for the jQuery function looks like: function addMessage() { if (textval != "") { text_string='<div class="alert-box round"><p class="text-left">' + userName + ...
The code snippet for the jQuery function looks like: function addMessage() { if (textval != "") { text_string='<div class="alert-box round"><p class="text-left">' + userName + ...
Such as: var foo = function (a, b) { return a + b; }; var bar = function (a, b) { return a * b; }; var fn = _.compose([foo, bar]); How to understand the fn?
Such as: var foo = function (a, b) { return a + b; }; var bar = function (a, b) { return a * b; }; var fn = _.compose([foo, bar]); How to understand the fn?