MailChimp API member-info issue

女生的网名这么多〃 提交于 2019-12-08 19:19:12

问题


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?


回答1:


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/




回答2:


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,
                          ),
                        ),
        );



回答3:


Mine does this as follows:

array(
  '0' => array('email' => $mail1)
  '1' => array('email' => $mail2)
  ...
  ...
);

Thanks,



来源:https://stackoverflow.com/questions/18956733/mailchimp-api-member-info-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!