At first this sounds good, but I’m not so sure. There is semantic knowledge in seeing that no posts exists for a tag. Does Google return a 404 when no results are returned from a search?
Google returns “204” code:
204 No Content
The server successfully processed the request and is not returning any content.
That was what I was thinking about … Not sure if it’s 100% accurate either but looks like the best fit for this scenario…
I think a 404
is more appropriate here.
204
means “your request was processed okay, and there is no result to show you”. That’s good for a search with no results, because you got what you asked for, it just turned out to be empty.
404
means “what you’re looking for never existed or no longer exists”, which seems more suitable for a request for a specific topic (which turned out not to exist).
Sure sounds good @neil can you add this to your list on tagging?
I also wasn’t sure if a 20x or 40x error was better, but I now agree that 404 is better. On my list!
204 is certainly wrong - 204 means you have a Content-Length of 0, i.e. no bytes returned.
The 200 was ok I guess, because it meant that it was a valid tag name but nothing had been tagged with it yet. It’s more helpful to say 404 because the tag doesn’t exist.
This was done today. Note that it’s still possible to get a 200 response with an empty topic list when filtered by both a category and an existing tag.