According to my understanding of mailchimp documentation, if one tries to add a member which already exists, it should return http status of 200, along with a member status of possible values: "subscribed", "unsubscribed", "cleaned", "pending", or "transactional".
However, I'm getting http status 400 with a "title" of "Member Exists".
With this behavior, I don't see a way to have dependable error handling code, since I don't think there is any guarantee that "title" strings are unmutable.
My PHP code creates params from form parameters as:
$params = array (
'email_address' => $email,
'status' => 'subscribed',
'merge_fields' => array (
'FNAME' => $first_name,
'LNAME' => $last_name,
...),
'tags' => $tags);
which are then JSON encoded and sent to mailchimp.
I'm testing with an email address that is already in the target list, in the "unsubscribed" state. The response from mailchimp is
(
[http_status] => 400
[response] => Array (
[title] => Member Exists
[status] => 400
[detail] => [email protected] is already a list member. Use PUT to insert or update list members.
[instance] => a9556e41-5e92-34bf-1ac6-1f7d35bca7f7
)
)
Why is it sending me http_status of 400 instead of 200 ?
I was having the same issue. For me the solution was converting the email string to lowercase before hashing it. Hope it helps!
Source: https://github.com/amro/gibbon/issues/239