HTTP Status codes are missing
The HTTP Status codes are referenced but a recommendation is not defined anywhere.
Here's a good example.
https://brockallen.com/2012/05/14/http-status-codes-for-rest/
@damienbod I think all the HTTP status codes are potentially valid options for a HTTP/REST API and therefore there seems no point to re-listing what is already listed here https://tools.ietf.org/html/rfc7231#section-6.1
For interaction scenarios that are part of the guidelines, the appropriate status codes are mentioned.
@darrelmiller true, but I think a recommended status code response list with headers for the PUT, CREATE, DELETE, GET and PATCH helps.
At the least, the reference to the HTTP Status codes in the document should reference your link.
@damienbod The right answer is "Follow the HTTP spec(s)".
I'm on board with words that say, "Follow the HTTP spec for return codes. The authoritative resource for this is found at {location}" I just don't want to be cut/pasting the various RFCs unless there is a good reason, as it's just creating maintenance work.
Historically the question that has come up is "Can I use status code X for Method Y? It's the right value according to the spec, but I'm worried that nobody will know what to do with a 418 (RFC 2324, section 2.3.2)". Or some other "Exotic" status code (aka: Not 400, 400, 500)?
The overwhelming answer to that question is, "If the authoritative / relevant spec defines it, then you can (and should) return that status code".
@cleemullins : Aren't there other cases in the REST API guidelines where we're effectively restating the HTTP spec in an effort to promote best practices? From my perspective, if people are frequently asking a question in the Internet somewhere (e.g. 'Should I use 403 or 404 when a user doesn't have access to content') , we would want to have a good answer defined for it in our best practices.
I think it's completely fair to omit infrequently used HTTP codes, but it's probably MOST important that we have best practices guidance around the most commonly used ones.
@brphelps
From https://tools.ietf.org/html/rfc7231#section-6.5.3
The 403 (Forbidden) status code indicates that the server understood the request but refuses to authorize it
An origin server that wishes to "hide" the current existence of a forbidden target resource MAY instead respond with a status code of 404 (Not Found).
I realize that I'm only addressing your one example here, but I think many people would be surprised how many "best practices" are described in the spec. I'm not saying there are not any places where guidance would be valuable. However, I'd prefer to see the guidelines include best practices for specific edge cases, rather than attempt to provide a simplified description of common status codes.
@darrelmiller -- just to be clear, I wasn't complaining about the HTTP spec's lack of clarity, I was only discussing the usefulness of our doc in covering general best practices, and noting that in other places (e.g. verbs we support w/ idempotency expectations) we do restate information that is readily available. Basically, I was hoping to see well known status code antipatterns called out, along with common tricky questions answered.
I can foresee cases where people (and Microsoft employees) will use our doc as a bible but won't recreationally read the HTTP spec and ensure they are adhering to its usages of status codes, and I do think our API guidelines will represent a big stick in trying to promote change :).
@brphelps I'm reluctant to put in the HTTP status codes as mere reference material. We put in the idempotency expectations for HTTP Methods not as reference but because we saw so many cases of folks building APIs that (for example) only use GET even for operations that were not idempotent.
@johngossman That seems like a totally good reason to include part of the HTTP spec in document -- common antipatterns we want to make sure we avoid. Thanks for taking the time to justify.