【问题标题】:Add Member in List mailchimp api not working [list memeber] cURL: The API key provided is linked to a different datacenter (status:403)在列表 mailchimp api 中添加成员不起作用 [list memeber] cURL:提供的 API 密钥链接到不同的数据中心(状态:403)
【发布时间】:2017-12-21 01:13:39
【问题描述】:

Mailchimp 列表添加成员使用 API 不工作 要求:

      $apikey = '#####################-us15';
        $data = array(
            'email_address' => 'test+mailchimp@gmail.com',
            'status' => 'subscribed',
            'merge_fields' => array(
                'FNAME' => 'taiabur rahman'
            )
        );
        $json_data = json_encode($data);

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://us2.api.mailchimp.com/3.0/lists/6de91c2e1c/members/');
    curl_setopt($ch, CURLOPT_HTTPHEADER, array("content-type: application/json"));
    curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    curl_setopt($ch, CURLOPT_USERPWD, "apikey:" . $apikey);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);

    $response_string = curl_exec($ch);
    $curl_info = curl_getinfo($ch);
    $curl_errno = curl_errno($ch);
    $curl_error = curl_error($ch);

    curl_close($ch);
    echo '<pre>';
    print_r($response_string);

    die('Mailchimp executed');

回应: { "类型":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/", "title":"错误的数据中心", “状态”:403, "detail":"提供的 API 密钥链接到不同的数据中心", “实例”:”” }

【问题讨论】:

    标签: mailchimp mailchimp-api-v3.0


    【解决方案1】:

    嗨,在 mailchimp 文档中将 url 更改为 https://us15.api.mailchimp.com/3.0/

    如果您的 MailChimp API 密钥的最后一部分是 us6,则所有 API 端点 您的帐户可通过https://us6.api.mailchimp.com/3.0/ 获取。

    你可以阅读完整的文档here

    【讨论】:

      猜你喜欢
      • 2017-06-07
      • 2019-02-26
      • 2020-01-31
      • 2023-02-11
      • 2016-11-18
      • 2016-02-08
      • 2014-05-23
      • 2015-03-08
      • 2017-11-21
      相关资源
      最近更新 更多