Re:I've been abusing HTTP Status Codes in my APIs for years
by conductr on Wednesday July 13, 2022 @10:35AM
(#32083348)
I think 404 being a common and useful server error is the issue. Had they/REST aligned on 204 No Content (for things like the employees/100 example) or something 2xx and less common I think it wouldn’t be much of an issue at all. I still think it’s actually not much of an issue. Of all the quirks out there, this creates little pain
[ Parent
| on HN ]
Re:I've been abusing HTTP Status Codes in my APIs for years
by dragonwriter on Wednesday July 13, 2022 @01:51PM
(#32086266)
> Had they/REST aligned on 204 No Content (for things like the employees/100 example)
Who is “they/REST”, and where have “they/REST” aligned on anything. All REST says is “use the underlying protocol without messing with its semantics, but only the parts that correspond to REST semantics”.
If the resource exists and is accurately represented by no data, then 204 fits for a gET, but that’s a different case than where there is no matching resource to the URL. 204 is mostly for modifying actions (e.g., PUT, DELETE) that don’t need to return more than the fact of success.