data icon indicating copy to clipboard operation
data copied to clipboard

Updating documentation with the default expected API responses.

Open stefek99 opened this issue 9 years ago • 7 comments

I've found this question on SO greatly informative: http://stackoverflow.com/questions/14922623/what-is-the-complete-list-of-expected-json-responses-for-ds-restadapter

ember response

For instance - I didn't know (until I saw that table) that editing model creates PUT request that expects the actual object in response.

  • returning 200 OK with no data is causing parsing error
  • returning 202 Accepted or 204 NoContent seems to be working fine

Is that information somewhere in the docs already?

stefek99 avatar Jun 08 '15 09:06 stefek99

I think @bmac would be able to point you in the right direction here. I don't know if he has it in his guides updates.

fivetanley avatar Jun 08 '15 13:06 fivetanley

This info looks great @stefek99. I don't think it exits in any one place in the guides. The table on the the-rest-adapter guide is the closest thing that I know of, however it doesn't have nearly this level of information.

bmac avatar Jun 08 '15 14:06 bmac

Thank you for your input.

One thing that I've discovered after 3 weeks of deep dive into Ember and Ember CLI and Ember Data - plenty of jsfiddle / jsbin examples are not working - people linking to 'latest' versions - and in general it is not a good idea as described here: http://blog.jquery.com/2014/07/03/dont-use-jquery-latest-js/

On the same note - many of the blogpost / StackOverflow answers are no longer accurate.

(feel free to close this issue, I just wanted to let you know about the table with expected responses)

stefek99 avatar Jun 09 '15 10:06 stefek99

I started working on this in my fork. My plan is to use this twiddle for reference, and save off the pretender request/response to a Gist, with links to the JSON-API docs (for the json-api adapter and serializer). The gists would be linked to from the table in the YUI docs.

Does this seem like a worthwhile approach? The hard part is presenting an example without addressing too many edge cases. There are so many ways to constructor and use endpoints, it is difficult to what would be a meaningful demonstration.

pete-the-pete avatar Jan 16 '17 20:01 pete-the-pete

Seems like a good idea @pete-the-pete.

bmac avatar Jan 23 '17 13:01 bmac

There's http://andycrum.github.io/ember-data-model-maker/, might want to enhance it.

locks avatar Jan 23 '17 16:01 locks

whoa, ember-data-model-maker is pretty slick...if supported saving or gists it could be pretty handy for reference

pete-the-pete avatar Jan 25 '17 04:01 pete-the-pete