If I have the following rest call:
GET /items/{id}/subitems
Should we return the following in these scenarios?:
- If
{id}
not found, should we return404 Not Found
? - If
{id}
found but not subitems found, should we return200 Ok
and an empty array?
For me the answer is yes for both questions.
REST is about resources. If resource with given ID hasn't been found, then
404 Not Found
is the most appropriate response status.But at the same time,
GET /items/{id}/subitems/{subitem-id}
should definitely return theHTTP 404
if subitem with given id doesn't exist.