Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the complete list of expected JSON responses for DS.RESTAdapter?
    text
    copied!<p>I am attempting to write a custom express.js based server for an Ember.js app. I am getting along fairly well but I'm constantly getting stuck trying to guess what JSON responses Ember Data is expecting at a given moment.</p> <p>This brand new documentation is a great start <a href="http://emberjs.com/guides/models/the-rest-adapter/">http://emberjs.com/guides/models/the-rest-adapter/</a> but not complete enough.</p> <p>My stabbing in the dark has lead me to understand (Ember pre4, Ember Data 11):</p> <pre><code>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 ??? ??? </code></pre> <p>Can someone help me fill in some of these blanks?</p> <p><strong>Edit, the complete list of expected JSON responses</strong></p> <p>These responses were gleaned from the <a href="https://github.com/emberjs/data/blob/master/packages/ember-data/tests/unit/rest_adapter_test.js">ember-data REST adapter unit tests</a> and by watching the network traffic on the <a href="https://github.com/dgeb/ember_data_example">Example Ember Data app</a>.</p> <pre><code>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]} </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload