In our project, a list of all books can be retrieved through REST:
GET http://server/api/books/
A specific book can be retrieved as following:
GET http://server/api/books/:id/
Deleting a specific book is easy:
DELETE http://server/api/books/:id/
Now, to my question: what should be the result of the following call:
DELETE http://server/api/books/
Obviously, all books are deleted. But should the resource books/ also be deleted? That is, after the request:
- should GET /books/ return 200 OK with an empty list? or
- should GET /books/ return 404 not found?
According to the specs, which says that the concrete URI will be gone afterwards, I'd go for the second option. However, this makes things complicated and unlogic, in my opinion. It makes more sense to have an empty list of books, instead of no books.
What do you think?