I'm using Guzzle version 6.3 and having issues with my request. I keep getting a 400 Bad Request error and I'm not sure the best approach to debug this or what might be causing the error. When I set this up using Postman and the same criteria all works properly.
$client = new GuzzleHttp\Client();
$body = $this->actionGenerateMessage();
try {
$response = $client->post('the/endpoint',
array(
'body' => $body,
'headers' => array(
'apikey' => 'apikeyhere',
)
)
);
} catch (RequestException $e) {
var_dump($e->getResponse()->getBody()->getContent());
}