What status code would you throw on a denied PUT or resource-creating POST request because the collection is full to some (business-logic derived) limit?
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
On Mar 22, 2013 10:35 AM, "Felipe Sere" <felip...@gmail.com> wrote:
>
> I would also add another argument to
> that:
> Adhering 100% to the status codes in the
> HTTP means that your client hast to be
> aware of the same granularity of status
> codes.
This is not true. Clients must be prepared to cope with any response code whether or not your api can generate it today. Per the HTTP spec [1]:
"applications MUST understand the class of any status code, as indicated by the first digit, and treat any unrecognized response as being equivalent to the x00 status code of that class"
A client that blows up when it encounters an unrecognized response code is broken. Period. Clients don't have any control over what the server sends them so they should be resilient to small changes like the use of more or less specific response codes. Otoh, clients are always free to treat any status they don't specifically understand, or don't care about, as the x00 code for its class so this requirement is not all that much work.
[1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html#sec6.1.1
Peter
Barelyenough.org
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
I tend to agree with @mca on this one. We usually start by mapping to the right range of errors (as described above)and then look for a more specific one.
I also make heavy use of the body to provide more application specific error information.
I would also add that I tend to care about status codes from a protocol level not from an application level. Put another way I believe any logic based on status code behavior should be able to be implemented into a generic library. Whereas anything meaningful to the application should be in the body.
Daniel