API batch_subscribe error

335 views
Skip to first unread message

Vladimir Bujak

unread,
Dec 4, 2013, 8:25:57 AM12/4/13
to mailchimp-...@googlegroups.com
Hi,
I am using batch_subscribe API call to import my contact into list.
I am using this format of data provided:

       
 $args['id'] = '5577fa8d41';
 $args
['batch']['email'] = array('email'=>'john...@myemail.com');
 $args
['batch']['merge_vars'] = array('FNAME'=>'John', 'LNAME'=>'Doe', 'INTERESTS'=>'Dogas, catas' );
 $args
['double_optin']       = false;
 $args
['update_existing']   = true;
 $args
['replace_interests'] = false;
 $args
['send_welcome']       = false;
 $args
['output']   = 'json';
 
 
 
//echo json_encode($args); exit;
 
 echo
"<pre>";
 print_r
($this->mailchimp_library->call('lists/batch-subscribe', $args));
 echo
"</pre>";

This is the response I get:
Array ( [add_count] => 0 [adds] => Array ( ) [update_count] => 0 [updates] => Array ( ) [error_count] => 2 [errors] => Array ( [0] => Array ( [code] => -99 [error] => An email address must contain a single @ [email] => john.doe@myemail.com ) [1] => Array ( [code] => -99 [error] => The email parameter should include an email, euid, or leid key [email] => ) ) )

However, it's not clear from error message what's wrong in my request. Someone please advice?

Civvy

unread,
Dec 4, 2013, 10:11:34 AM12/4/13
to mailchimp-...@googlegroups.com
Hi Vladimir,

Your batch is going to need to be an array of arrays where the 'merge_vars' follow the structure outlined here, assuming you're using 2.0: http://apidocs.mailchimp.com/api/2.0/lists/subscribe.php.  Interest groups contain either a name or id, and an array of valid group names.


Reply all
Reply to author
Forward
0 new messages