I have an AngularJS application backed by a RESTful Symfony app. I have a problem to POST users (e.g. POST /api/users/123
).
Here is what Symfony Form expects in a POST request (to edit or submit a resource):
{
"user": {
"email":"foo@mnapoli.fr"
}
}
You see here that the object that is being posted is wrapped in another user: {…}
object (that represents the form).
Here is what Angular's $resource will post when calling user.$save()
:
{
"email":"foo@mnapoli.fr"
}
Here there is no wrapper. The object is posted directly.
- which one is "correct", i.e. RESTful?
- how can I make Symfony, or Angular, work with the other (based on the previous answer)?