Response status code for searches in REST APIs
Suppose, we have the following API: GET /api/guests/{id} GET /api/guests?name=dummy Which status code should I return when there are no guests matching criteria? I mean no guests with name dummy . Should it be 404 , 204 or 200 with an empty array? I would return 200 with an empty array... Or a 204 (No Content) A 404 is when a resource isn't found. Your resource in this case is the collection of guests... which exists. The proper status code for each situation Consider the following situations: GET /api/guests?name=dummy It's an operation that requests a representation of a collection. If no