I am trying to create a REST service with Symfony2. I followed a few articles, and got the GET functions working; I am able to fetch a list of my objects, or a specific one. But saving my object to the database with a POST doesn't work. I am using the FOSRestBundle.
I created my entity Coldlead, my form ColdleadType, and created my newAction in the controller. But when I test the POST action with curl on bash, it seems that no information is being received by the FORM.
This is the command I execute:
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"coldlead":{"registeredAt":"2013-04-12", "firstName": "John", "lastName": "Doe"}}' http://mvibesemail.roland.local/app_dev.php/coldleads | less
The reponse is:
{"form":{"children":{"firstName":[],"lastName":[],"email":[],"registeredAt":{"errors":["This value should not be blank."],"children":{"date":{"children":{"year":[],"month":[],"day":[]}},"time":{"children":{"hour":[],"minute":[]}}}},"ip":[],"fromSiteUrl":[],"isConfirmed":[],"isVerified":[],"isMember":[],"unsubscribeUrl":[]}}}
I think I am missing one final link. Maybe something with the serializer. Hopefully somebody could give me a hint.
The articles I read (and tried) are: