Please give me examples of official specification, or trusted recommendations that can prove my business partner that when they return an empty list from a REST endpoint, the HTTP status should be 200, not 404. For me RFC-2616 is obvious, but also general and doesn't discuss the case of an empty set as a result. I'm looking for strong arguments for a discussion.
Kind regards, Kamil.
RFC 2616 is an obsolete document. The current specification for the 404 status code is RFC 7231 § 6.5.4, which seems clear enough to me:
The 404 (Not Found) status code indicates that the origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
If the empty list is a valid representation of your resource (as opposed to an error message, for example), this precludes 404.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With