Mailchimp-405方法不允许

时间:2019-10-28 17:00:33

标签: php mailchimp mailchimp-api-v3.0

具有一个突然停止工作的现有API。 GuzzleHttp用于此项目。 无法使用Mailchimp通过API删除用户。回应;

405 Method Not Allowed response: {"type":"http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/","title":"Method Not Allowed", "st (truncated...) in vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113

这是我的代码;

public function __construct()
{
    $this->client = new Client([
        'auth' => ['bread', getenv('MAILCHIMP_API_KEY'), 'basic'],
    ]);
}

public function delete_member_from_list(string $member_email, string $list_id): ResponseInterface
{
    $subscriber_hash = $this->get_subscriber_hash($member_email);
    // Just making sure vars are defined and they are
    error_log('List id: ' . $list_id);
    error_log('Hash: ' . $subscriber_hash);

    return $this->client->delete("{$this->endpoint}/lists/{$list_id}/members/{$subscriber_hash}");
}

Mailchimp documentation指出:This error means that the requested resource does not support the HTTP method you used.

这是从API documentation中删除列表中的成员;

Mailchimmp API[3

最后是来自Guzzle;

guzzle

所以看来http方法是正确的,但是Mailchimp仍然返回405。

谢谢。

信息;

  • PHP 7.2.19-0ubuntu0.18.04.2(cli)(建立:2019年8月12日19:34:28)(NTS )
  • SSL

0 个答案:

没有答案