What is the expected format of the server response to PUT command when using RESTAdapter?


Hi everybody

I currently trying to create a small Java Server providing the service for the TodoMVC EmberJs sample you provide.

I would like to get the generated _ID on the server side in the server response in order to update the created Todo model.

Few things are in the documentation to explain how to use the Default RESTAdapter feature if you don’t use Ruby On Rail. (like the expected server responses, or the format of the data send by the RESTAdapter, the use (or not) of the “s” with the model in the URI (GET /api/todos to FindAll)

An almost similar question is here in stackoverflow (but with no response)

Best regards


A good overview of the expected format for get, put, etc. can be found here: http://blog.embed.ly/post/50012690904/ember-at-embedly-tutorial-models-and-ember-data

It is indeed so that you need to return the complete object after a put. You can monitor this by using Ember extensions for Chrome. In the data tab, you will see that upon creation of a new record the properties are filled when you start entering data in for example an input field. When clicking save (transaction.commit), you enter inFlight status and at that moment you have a model with all fields completed, except the id field. When the server response comes in, the model is updated with the received data: the id property is completed and all other properties are overwritten with the data received from the server. If you thus only return the id, the other properties will be cleared out …


Thank you very much for the link !!

(Ember extensions for Chrome don’t find my ember app, I open an issue on its github’s project)


Are you developing locally? Go into you Extension settings and check the box labeled “Allow access to file URLs”. That fixed the extension for me.

Expected GET responses