News for hackers. Stuff that matters.
Re:I've been abusing HTTP Status Codes in my APIs for years by treis on Wednesday July 13, 2022 @08:55AM (#32081936)
>Which is not to say you are wrong if you return a 400

5XX - Server did something wrong

4XX - Client system did something wrong

2XX - Everything worked

IMHO, what's missing is a code for "All systems worked but the user did something wrong" for scenarios like looking up a non existent ID or if their CC details don't work.

Re:I've been abusing HTTP Status Codes in my APIs for years by thr0wawayf00 on Wednesday July 13, 2022 @09:04AM (#32082062)
I've always interpreted 422 to fit this case: a well-formed request that cannot be processed due to the content in the payload.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422

Re:I've been abusing HTTP Status Codes in my APIs for years by zinekeller on Wednesday July 13, 2022 @09:15AM (#32082198)
Unfortunately, literal reading of 422 implies that the sent content has error(s) and not the header. It's close, but I still feel that for GET requests it's wrong.