I was wondering if you could shine some light on how to handle responses where models and model collections do not exist or the collection is empty. What is the general consensus in the community for status codes? Or is there a REST spec out there I can look at? I've yet to find one other than different people providing guidelines (like the storm path video on youtube).
Should /users/123 return 404?
Should /users?IsActive=true return a 200 or 404?
Also, what are your thoughts on using sub status codes, like 404.1, 404.2, etc?
For an empty collection I return 200 OK with an empty collection, for a non-existent single resource/record I would return a 404.
I wouldn't use substatus codes, they're an IIS specific extension, i.e. not HTTP standard. You can find a good description of HTTP status codes at:
Thanks Demis. As always you have an incredible response time. Your help is always very much appreciated!
+Stephen Brannan In addition to what Demis mentioned, if you are looking for a good resource on how to design REST services, have a look at "RESTful Web Services Cookbook" by O'Reilly (http://shop.oreilly.com/product/9780596801694.do). Highly recommended.
Thanks +Hardy Erlinger I'll check the book out. Overall I think I have a good understanding of REST services design. There seems to be conflicting ideas in the details though. Maybe someday there will be an official spec from someone like w3c.