具有一个突然停止工作的现有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中删除列表中的成员;
最后是来自Guzzle;
所以看来http方法是正确的,但是Mailchimp仍然返回405。
谢谢。
信息;