I'm using Ember-Data 1.0.0.Beta-9 and Ember 1.7 to consume a REST API via DreamFactory's REST Platform. (http://www.dreamfactory.com).
I've had to extend the RESTAdapter in order to use DF and I've been able to implement GET and POST requests with no problems. I am now trying to implement model.save()
(PUT) requests and am having a serious hiccup.
Calling model.save() sends the PUT request with the correct data to my API endpoint and I get a 200 OK response with a JSON response of { "id": "1" }
which is what is supposed to happen. However when I try to access the updated record all of the properties are empty except for ID and the record on the server is not updated. I can take the same JSON string passed in the request, paste it into the DreamFactory Swagger API Docs and it works no problem - response is good and the record is updated on the DB.
I've created a JSBin to show all of the code at http://emberjs.jsbin.com/nagoga/1/edit
Unfortunately I can't have a live example as the servers in question are locked down to only accept requests from our company's public IP range.
DreamFactory provides a live demo of the API in question at https://dsp-sandman1.cloud.dreamfactory.com/swagger/#!/db/replaceRecordsByIds
model.serialize()
, except that theid
property should be populated for the model, plus any nested/embedded related models. – Josh PadnickRESTSerializer
expects a response richer than just{ id: 1 }
. Check out stackoverflow.com/questions/14922623/… and see if that helps. I'm not 100% sure this is the issue, though. – Josh Padnick