I need to retrieve all users infos via api, looking for it in the documentation I found this: http://apidocs.mailchimp.com/api/2.0/lists/member-info.php
This is my code:
$params = array(
'id' => $list_id,
'emails' => array(
'euid' => $member_id,
),
);
$infos = $this->MailChimp->call('lists/member-info', $params);
print_r($infos);
and this is the result:
Array ( [success_count] => 0 [error_count] => 1 [errors] => Array ( [0] => Array ( [email] => 63a885b7cf [error] => "email" should be a struct [code] => -100 ) ) [data] => Array ( ) )
What does " "email" should be a struct " means?
API keys grant full access to your Mailchimp account and should be protected the same way you would protect your password.
Click on an existing text block or add a new text block to your campaign and click to edit the text block. Click (place your cursor) wherever you'd like the first name to appear to the right side of the screen, click “Merge Tags” in the toolbar and then click “First Name”.
Make sure your link is really a link. To ensure your formatting is correct before you send, enter preview mode and use the link checker tool. If you're working with the new email builder, we'll mark broken links with an exclamation point icon as you add your content.
This also works and is slightly simpler:
$result = $MailChimp->call('lists/member-info', array(
'id' => $list_id,
'emails' => array(array('email'=>$email))
));
The above example uses this API: https://github.com/drewm/mailchimp-api/
Solved!
My $params
array was wrong.
MailChimp need an array format in this way:
$params = array(
'id' => $list_id,
'emails' => array(
0 => array(
'euid' => $member_id,
),
),
);
Mine does this as follows:
array(
'0' => array('email' => $mail1)
'1' => array('email' => $mail2)
...
...
);
Thanks,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With