php - Zend_Http_Client - Response Error- Boolean Invalid -


I am trying to figure out why I got an invalid boolean error while posting to a URL? The error and code is below.

Thoughts will be highly appreciated, I can also provide more information.

error response:

  Array ([error] => Array [error code] => 1008 [error type] => validation [error message ] = & Gt; Invalid Boolean Value [obj] => CollectionOn Delivery) [Data] = & gt;)  

Code:

  $ Client = new Zend_Http_Client ($ url); $ Customer & gt; SetMethod (Zend_Http_Client :: post); $ Client- & gt; Set header ('host', 'url.api.com'); $ Client- & gt; Set header (Zend_Http_Client :: CONTENT_TYPE, 'application / json'); $ Client- & gt; Set header ('accept', 'app / jason'); $ Client- & gt; Set header ('content-length', strollon ($ payload)); $ Client- & gt; SetParameterPost (array ('collection on delivery' = & gt; wrong, 'job id' = & gt; null, 'invoice' = & gt; null, 'collectionDate' = & gt; $ date, 'aggregate' = & gt; Wrong, 'goods', $ payload)); $ Response = $ client- & gt; request ();  

API documentation

  Example request is shown: POST / url HTTP / 1.1 host: url.api.com Content Type: Application / Jason Accepted: Application / Jason Content-Length: 2416 {"Job_ID": blank, "Collection On Delivery": Incorrect, "Invoice": blank, "Date of Collection": "2012-05-01T09: 00: 00", "Consolidated : "Consignment": [{Details about details of consignment}}}  

Post parameter

Collection on delivery Boolean

Goods []

Collection Date Date

Strengthen Boolean

The HTTP posting values ​​are string, so when you try to pass a boolean, you are getting the error, try changing your boolean with a wire:

  'Store Delivery '= & Gt; "False",  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -