2

I'm having weird update errors on some routes so I just wanted to sure that it wasn't something fundamental at this level.

At the moment I do this:

Create   POST       /plural        201    {"singular": {"id":"1", ...}} 
FindAll  GET        /plural        200    {"plural": [{"id":"1",... },{"id":"2", ...    
Find     GET        /plural/1      200    {"singular": {"id":"1", ...}} 
Update   PUT/PATCH  /plural/1      200    {"singular": {"id":"1", ...}} 
Delete   DELETE     /plural/1      200    (empty)

I serve 404s or 400s depending on whether the route looks good.

Is this to spec as far as you can see?

Sambeau
  • 245
  • 1
  • 3
  • 12

1 Answers1

1

You should use correct http status codes for your cases. This page has good explanations.

404 : If the path (eg. /plural) is not available.

422 : If the request is erronous. Ember Data guide says it works good with 422. Also search for 422 in this site.

204 No Content: If no data returned. (Such as deletion.)

Further, if you want have a check JSON API Specs:

ykaragol
  • 6,139
  • 3
  • 29
  • 56