HTTP status code for a REST search without result

Viewed 2946

I have a REST endpoint for a search.

GET /person?firstname=john&name=smith

As result a collection with the HTTP status code 200 OK is returned:

[
   {
      "id":11,
      "firstname":"John",
      "name":"Smith",
      "birthday":"1996-03-08"
   },
   {
      "id":18,
      "firstname":"John",
      "name":"Smith",
      "birthday":"1963-07-11"
   }
]

What is the correct HTTP status code and payload for a empty search result?

  • HTTP Status 200 OK with a empty collection []

  • HTTP Status 204 No Content with a empty collection []

  • HTTP Status 204 No Content with a empty body

3 Answers
Related