Mad Mimi API

The Mad Mimi API allows simple programmatic access via HTTP to specific features of Mad Mimi. You can use any programming language that speaks HTTP to interact with Mad Mimi's API.

Currently, the Mad Mimi API provides a single feature: Audience Import. We plan to add more features in the not-too-distant-future, so let us know what would be helpful to you. Have a look at the following examples and explanations to learn how to use the Audience Import feature.

In English

POST to http://madmimi.com/audience_members with 3 parameters:

  • Your Mad Mimi username
  • Your Mad Mimi password
  • A csv_file OR unstructured input

Sample input

The CSV file should have a header row with column names like: "name", "first name", "dog", "band name", "opt out", and "email". Email is the only required column and you can use any names you'd like for the rest. Here is a sample:

first name,last name,email
dave,hoover,dave@example.com
colin,harris,colin@example.com

Here is a sample that includes list support (Dave is in two lists):

name,email,add_list
dave hoover,dave@example.com,customer
dave hoover,dave@example.com,premium
colin harris,colin@example.com,customer

Here is a sample that includes opt-out support (Dave has opted out):

email,opt-out
dave@example.com,1
colin@example.com,

The unstructured input can look like:

dave@example.com, "Colin Harris" 
joe@example.com
"Gary" 

In Ruby

require 'net/http'

csv_data = "email\ndave@example.com\ncolin@example.com"

url = URI.parse('http://madmimi.com/audience_members')
response = Net::HTTP.post_form(url, {
  'username' => 'your.email@example.com', 
  'password' => 'testing', 
  'csv_file' => csv_data
})

In Perl

use LWP::UserAgent;

my csv_data = "email\ndave\@example.com\ncolin\@example.com";

my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(POST => 'http://madmimi.com/audience_members');
$req->content("username=your.email\@example.com&password=testing&csv_file=$csv_data");

# Pass request to the user agent and get a response back
my $res = $ua->request($req);

In PHP — Courtesy of Geert De Deckere

<?php

$username = 'your.email@example.com';
$password = 'testing';
$csv_data = "email\ndave@example.com\ncolin@example.com";

$ch = curl_init('http://madmimi.com/audience_members');
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS,
'username='.$username.'&password='.$password.'&csv_file='.$csv_data);
$response = curl_exec($ch);

You can really use many other languages that can consume web services with the API, and if you have any samples of languages other than Perl, PHP and Ruby, please let us know!

Your Email
Password