I'm trying to figure out why I'm getting an invalid boolean error when posting to a URL. Error and code is below.
Ideas would be greatly appreciated, I can also provide more details.
Error response:
Array(
[error] => Array (
[errorCode] => 1008
[errorType] => Validation
[errorMessage] => Invalid boolean value
[obj] => collectionOnDelivery
)
[data] =>
)
Code:
$client = new Zend_Http_Client($url);
$client->setMethod(Zend_Http_Client::POST);
$client->setHeaders('Host', 'url.api.com');
$client->setHeaders(Zend_Http_Client::CONTENT_TYPE, 'application/json');
$client->setHeaders('Accept', 'application/json');
$client->setHeaders('Content-Length', strlen($payload));
$client->setParameterPost(
array(
'collectionOnDelivery' => false,
'jobId' => null,
'invoice' => null,
'collectionDate' => $date,
'consolidate' => false,
'consignment', $payload
));
$response = $client->request();
API documentation
Example Request is shown below:
POST /url HTTP/1.1
Host: url.api.com
Content-Type: application/json
Accept: application/json
Content-Length: 2416
{
"job_id": null,
"collectionOnDelivery": false,
"invoice": null,
"collectionDate": "2012-05-01T09:00:00",
"consolidate": false,
"consignment": [{ // Array of details about consignment }]
}
Post Parameters
collectionOnDelivery boolean
consignment object[]
collectionDate date
consolidate boolean
collectionOnDeliveryparameter.