What is the complete list of expected JSON responses for DS.RESTAdapter?

I am trying to write my own express.js based server for an Ember.js application. I get along well, but I'm constantly stuck trying to guess which JSON Ember Data answers are currently awaiting.

This new documentation is a great start to http://emberjs.com/guides/models/the-rest-adapter/ , but not complete enough.

My bell in the dark made me understand (Ember pre4, Ember Data 11):

Context Server URL Method Req. Data Resp. Data ~~~~~~~ ~~~~~~~~~~ ~~~~~~ ~~~~~~~~~ ~~~~~~~~~~ Getting a list of all users /users GET {"users":[{...},{...}]} Getting a particular user /users/123 GET {"user":{...}} Creating a user /users POST {"user":{...}} ??? Updating a user /users/123 PUT {"user":{...}} ??? Deleting a user /users/123 DELETE ??? ??? Creating a user (bulkUpdate) /users POST {"users":[{...},{...}]} ??? Updating a user (bulkUpdate) /users/bulk PUT {"users":[{...},{...}]} ??? Deleting a user (bulkUpdate) /users/123 DELETE ??? ??? 

Can someone help me fill in some of these gaps?

Edit, a complete list of expected JSON responses

These answers were gleaned from the tests of the ember-data REST-adapter block adapter and looked at the network traffic on the Example Ember Data Application .

 Context Server URL Method Req. Data Resp. Data ~~~~~~~ ~~~~~~~~~~ ~~~~~~ ~~~~~~~~~ ~~~~~~~~~~ Getting a list of all users /users GET {"users":[{...},{...}]} Getting a particular user /users/123 GET {"user":{...}} Creating a user /users POST {"user":{...}} {"user":{...}} Updating a user /users/123 PUT {"user":{...}} {"user":{...}} Deleting a user /users/123 DELETE N/A null Creating a user (bulkCommit) /users POST {"users":[{...},{...}]} {"users":[{...},{...}]} Updating a user (bulkCommit) /users/bulk PUT {"users":[{...},{...}]} {"users":[{...},{...}]} Deleting a user (bulkCommit) /users/bulk DELETE {"users":[1,2]} {"users":[1,2]} 
+47
ember-data ember-router
Feb 17 '13 at 15:22
source share
2 answers

Instead of stabbing in the dark, see rest-adapter-test

For example, to fill out your question about mass update responses, the L738 describes the expected response data:

 ajaxHash.success({ people: [ { id: 1, name: "Brohuda Brokatz" }, { id: 2, name: "Brocarl Brolerche" } ]}); 
+24
Feb 18 '13 at 21:17
source share

Currently searching for phrases ajaxResponse( in rest-adapter-test.js source nested in test("create - a payload with a new ID and data applies the updates" ) looks the same to read the required server response.

0
Aug 21 '15 at 11:58
source share



All Articles