mercredi 27 septembre 2017

400 Bad Request When Adding Member to MailChimp List

I am sending a POST request to the following resource and getting a 400. I understand what the error means, but still am unsure why I'm getting it when a GET request to the same resource works.

/lists/{list_id}/members

Here is a exerpt of the code:

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', // <-- Drop in a GET here and it works, other than it's not the behavior I need.
    env('MAILCHIMP_API_URL') . 'lists/' . env('MAILCHIMP_LIST_KEY') . '/members',
    [
        'auth'  => ['app', env('MAILCHIMP_API_KEY')],
        'query' => [
            'email_address' => 'donnie@test.com',
            'email_type'    => 'html',
            'status'        => 'subscribed',
        ]
    ]);

dd($response->getStatusCode());



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire