Re:I've been abusing HTTP Status Codes in my APIs for years
by wizofaus on Wednesday July 13, 2022 @11:34AM
(#32084124)
If you write an API designed to return a single entity matching the path provided, it's absolutely an error if it doesn't exist. If your API returns the simplest possible JSON representation in a success case, what JSON should it return if it doesn't exist?
If you ask for an employee that doesn't exist, is it a failure? Or is it just a negative, but expected response?
Perhaps that's a stupid question though.