When creating single page apps that communicate with a backend API via ajax, what is common (best?) practice regarding updating different server side database objects as a result of one client side action? For example let's say I delete something on the client which in turn results in needing to update several other items.
Perhaps we have an app that simulates people standing in a line. Each person has a position in the line. The user has the ability to delete a person from the line which results in two actions. First, delete the person from the database. Second, update the remaining people in the database to reflect their new position in the line. (This is a simple illustration, but there may also be additional database updates required to other, non person db tables).
Should the above be done in two separate ajax requests? First send the DELETE request and if the server replies with a success message, then send a PATCH request to update the remaining people positions. Or should both of those be combined into a single ajax call?
The reason I ask is because doing two separate requests would be more RESTful from the API perspective. ie: Send a DELETE request for a single object, get a success reply on the client, then send a PATCH request for multiple objects. The URLs for those would conform to typical RESTful structures.
However if you combine those requests into one it means you have to have an API endpoint which certainly is not RESTful by deleting and patching multiple items in one call. It would also not use a typical URL structure. But you end up with only one call to the server and one response confirming that everything required has been done.
So my question is, when creating SPAs with fairly complex interactions with respect to creating / deleting / updating multiple objects at once, should we still try to be RESTful in the way that the API is created and used or do we create API endpoints that do exactly what is needed in a single server call?