Error Code=214 when using update_existing=true

561 views
Skip to first unread message

Noah

unread,
Feb 20, 2014, 5:59:15 PM2/20/14
to mailchimp-...@googlegroups.com

I have just setup list subscribe using php and MCAPI examples and all seems to be working well besides the update_existing.

if($_POST['submit']) {
require_once 'MCAPI.class.php';  
$apikey = 'mykey'; 
$listId = 'mylist'; 
$my_email = $_POST['email']; 
$merge_vars = Array('FNAME' => $_POST['first_name'], 'LNAME' => $_POST['last_name'] );  
$double_optin = false; 
$update_existing = true;
$send_welcome = false;  
$api = new MCAPI($apikey);  
$retval = $api->listSubscribe( $listId, $my_email, $merge_vars, $double_optin, $update_existing,$send_welcome); {
if ($api->errorCode){
echo "Unable to load listSubscribe()!\n";
echo "\tCode=".$api->errorCode."\n";
echo "\tMsg=".$api->errorMessage."\n";
} else {
echo "Subscribed - look for the confirmation email!\n";
}
}
}


And I receive this error:  

Unable to load listSubscribe()! Code=214 Msg=subsc...@email.com is already subscribed to list MyList. Click here to update your profile.

Any suggestions?
Thank you!

Colt

unread,
Feb 20, 2014, 8:51:15 PM2/20/14
to mailchimp-...@googlegroups.com
Hey Noah,

Taking a look at that particular listSubscribe call it appears the email_type parameter is missing. This will come after merge_vars and before double_optin when using the wrappers. 

Here's an example

$my_email = 'te...@testing.com'; 
$merge_vars = Array('FNAME' => 'Test', 'LNAME' => 'Name' );  
$double_optin = false; 
$update_existing = true;
$send_welcome = false;
$email_type = 'html';
$api = new MCAPI($apikey);  
$retval = $api->listSubscribe( $listId, $my_email, $merge_vars, $email_type, $double_optin, $update_existing,$send_welcome);

Noah

unread,
Feb 20, 2014, 10:36:13 PM2/20/14
to mailchimp-...@googlegroups.com
That did it!

Thanks for that.  I didn't realize that I needed to add email_type. 
Reply all
Reply to author
Forward
0 new messages