Let's say an API has the method DELETE
for the endpoint /authors/:id
, which also deletes all posts by said author.
I understand that, when an author is deleted from the database, all GET
requests to /authors/:id/posts
should respond with 410 GONE
, indicating that said resource is no longer available.
How should the API understand that the resource used to exist but no longer does? After all, the query SELECT * FROM posts WHERE author_id = id;
is empty.
The only "solution" I thought of was to not delete the posts, but check the existence of the author in the database and act accordingly.