I am having a problem posting JSON data to my Restler Web Service using the Restler API Explorer.
Here is an example
/**
* Inserts a product
*
* @param string $product_id {@from body} The SKU for the product
* @return a product object which contains the product
*/
function post($product_id=NULL, $request_data=NULL){
error_log(var_export($request_data,1));
}
When I post the following JSON string thru the explorer
{"product_id": "MOO"}
I get the following outputted in the log
array ('{____"product_id":_"MOO"}' => '','index_url' => 'index',)
Whereas if I use CURL e.g.
curl -X POST http://xxx.xxx.xxx/products.json -H "Content-Type: application/json" -d '{"product_id": "MOO"}'
I get
array ('product_id' => 'MOO','index_url' => 'index',)
Which is what I would expect.
Can any spot what is wrong?
Cheers Rob
This is due to a bug in API Explorer that is fixed a month back
Update your explorer to the latest from https://github.com/Luracast/Restler-API-Explorer
Delete your cache and see the issue go away