I have written a rest service application.
I send this json request to the service:
POST /AndroidEvent/index.php/api/events HTTP/1.1
Host: localhost
Content-Type: application/json
Cache-Control: no-cache
{ "data": { "name": "ApiTest", "city": "Budapest", "place" : "Budapest 1082 Népszínház utca 18.", "event_start_date" : "2014-09-01 00:00:00", "event_end_date" : "2014-09-21 00:00:00", "decription" : "Ez egy leírás ide", "category_id" : 1, "owner_id": 2, "coord_latitude" : "47.4544", "coord_longitude" : "47.4544", "picture_path" : "http://localhost/picture_path", "is_adult" : 0, "created_on" : "2014-09-21 00:00:00", "updated_on" : "" } }
But on the server side in the routes.php I could not get the post data in this way:
$app->request->post('data') // I will get an empty array.
But in this way I can get the post data:
json_decode($app->request->getBody());
Is it impossible to get the post data with the $app->request->post('data')
?