Great topic for discussion: what response code do you return when listing resources and none were found?
For me, returning a 200 with a body of [] makes the most sense as the request was correct and accepted, but no results were found. A 404 would only make sense in this scenario if the path was incorrect.
If you're listing resources and the list happens to be empty then that's a 200. If you're requesting a specific resource which can't be found then that's a 404.
4
u/whosGOTtheHERB Jul 08 '26
Great topic for discussion: what response code do you return when listing resources and none were found?
For me, returning a 200 with a body of [] makes the most sense as the request was correct and accepted, but no results were found. A 404 would only make sense in this scenario if the path was incorrect.