Mailchimp API v3.0

Has anyone successfully set up an $http post to add a subscriber to a Mailchimp list in the v3.0 API? I’ve written the below code (and have tried various different suggestions that I have read on the forums). The problem I am getting is XMLHttpRequest cannot load No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:8100’ is therefore not allowed access. The response had HTTP status code 501.

$scope.saveSubscribe = function () {
    var url = '';
    var subscription = { "email_type": "", "status": "subscribed", "merge_fields": {"FNAME": "John", "LNAME": "Smith"}};
    var req = {
        method: 'POST',
        url: url,
        headers: {
            'Content-Type': 'application/json',
            'Auth-Token': "username APIKEY",
            'Authorization': "username APIKEY",
            'Authorized': "username APIKEY"
        data: subscription
    success(function(data, status, headers, config) {
        console.log('[Debug] success', data);
        alert('Clever boy');
    error(function(data, status, headers, config) {
        console.log('[Debug] failed', status, config, headers, data);
1 Like

Experienced the same issue.

Where can I find integration code with Ionic and MailchimAPI

Add subscribers, send email after subscription, etc


For those who come across this issue, I’ve found a good solution:
It works with ionic#1.3.1

I had to make some adjustments I hope they accept them, if they don’t you need to apply this fix: to make it work with cordova.