So my problem is that I'm currently developing a restful api using lumen and the idea is that a user can have many listed pets for adoption, any logged in user can have this pet marked as reserved for adoption... when the user clicks the reserve button, a notification is sent to the owner(via pusher and database channels), the notification contains the id of the pet listed and the user id of the one who's requesting this pet for adoption, so what the owner will see is a notification with two buttons for approving or disapproving the adoption request, my question is from a restful perspective, when any button is clicked (i.e. approve or disapprove), I should remove the notification and the reservation in one go?
Example: I send a DELETE request to the following endpoint /user/notifications/{id}, first I get the user id(who wants to adopt) and the listing id, and delete the reservation, then delete the notification for the owner? DB Design
Can a restful api remove two related resources from a single endpoint?
Yes; which is to say that the server might handle the request
DELETE /user/notifications/1
by performing a delete of "/user/notifications/1" and "/reservations/2" and "/foo" and "/bar" and "/881b1e4a-f84f-47c7-886b-e818e13b6168".
Where things can get tricky: the semantics of DELETE are to act on just the resource identified by the target URI. Which is to say that general purpose components that speak HTTP are not necessarily going to understand that multiple resources are being changed.
For instance, the server could include in the list of deleted resources in the message-body of the HTTP response, but we don't have a standardized way to encode that list into the response headers, which is where general purpose components are looking for meta data.
So it's likely that a general purpose component will remove "/user/notifications/1" from its cache, but it will not do anything with its locally cached representations of the other responses.