How do i get post data through the guzzle service clients getCommand
function?
my json looks like the following:
"createMessage": {
"httpMethod": "POST",
"uri": "conversations/{conversation_id}/message",
"summary": "conversations by user",
"responseType": "class",
"responseClass": "\\Conversations\\Message",
"parameters": {
"conversation_id": {
"location": "uri",
"description": "conversation id",
"type": "integer"
},
"message": {
"location": "postField",
"sentAs": "message",
"type": "string"
}
}
}
then i currently put my post data as part of the array passed through the getCommand:
$client = new \Guzzle\Service\Client();
$client->setDescription(\Guzzle\Service\Description\ServiceDescription::factory(__DIR__ . '/client.json'));
$command = $client->getCommand('createMessage', array('conversation_id' => 6, 'message' => 'test post message'));
it creates the new record in the database but the post data is empty so the 'message'
field is left empty.
i have tried setting $client->setPostField('message', 'test post message');
but doesn't appear to work.