hugofirth / laravel-mailchimp

A composer package for the MailChimp API PHP class (as provided by MailChimp) which supports the Laravel 4 framework.
96 stars 27 forks source link

Mailchimp Member Info Error #34

Closed thecodecafe closed 8 years ago

thecodecafe commented 9 years ago

Whenever i try to get member info like so. MailchimpWrapper::list()->memberInfo($list_id, ["example@email.com"]); I get the following response array(4) { ["success_count"]=> int(0) ["error_count"]=> int(1) ["errors"]=> array(1) { [0]=> array(3) { ["email"]=> string(19) "example@email.com" ["error"]=> string(26) ""email" should be a struct" ["code"]=> int(-100) } } ["data"]=> array(0) { } } Any idea how to solve this?

ksetiya commented 8 years ago

Hi you need to pass a multidimensional array (which is what is meant by a struct in this case) as the second argument since a user can have multiple email addresses:

Change : MailchimpWrapper::list()->memberInfo($list_id, ["example@email.com"]);

to:

MailchimpWrapper::list()->memberInfo($list_id, ['emails' => ['email' => 'example@email.com']]);

Good luck :)

thecodecafe commented 8 years ago

O! Thanks should close this now!