Response status code for searches in REST APIs

后端 未结 3 1746
粉色の甜心
粉色の甜心 2020-12-03 11:53

Suppose, we have the following API:

GET /api/guests/{id}


        
3条回答
  •  情书的邮戳
    2020-12-03 12:20

    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.

提交回复
热议问题