I have a plugin that listens for new users to be created. I am then sending that user to system "B" via an API call.
All is working fine the old fashion way, I am curious how to accomplish the same using Guzzle.
$client = new \Guzzle\Http\Client('http://api.site.dev/');
$uri = 'my/endpoint/path';
$request = $client->post($uri, array(
'headers' => array('Content-type' => 'application/x-www-form-urlencoded'),
'body' => array(
'craft_id' => $event->params['user']->id,
'name' => $event->params['user']->friendlyName,
'email' => $event->params['user']->email
),
'timeout' => 10
));
$response = $request->send();
Each time I get this response/error back:
Client error response
[status code] 422
[reason phrase] Unprocessable Entity
Which tells me that system "B" isn't getting the information in the correct format. The docs aren't so great with post examples, so I'm not quite sure where I'm going down the wrong path.
Thank you for any suggestions!