DEV Community

Discussion on: 404 status code! Really?

mdamaceno profile image
Marco Damaceno Author

An empty list is no content as well. Why not use 204 for it?

Thread Thread
pchinery profile image

If you have no items for the list, returning an empty list will yield the full available content. Maybe you will also add some metadata (e.g. total number of entries) to support pagination. Your consumer will not have to treat this differently from a filled list. When requesting a single item that does not exist, users would have to examine the content and see if they can work with it. And from my experience: if you start seeing surprising responses, the trust in the responses from this system drops rapidly.