begin transaction;
write to db;
post /api
commit;
Assuming rollback is implicit when an exception occurs, failure at any point results in the whole operation not executing. begin transaction;
write to db;
post /api
commit;
Assuming rollback is implicit when an exception occurs, failure at any point results in the whole operation not executing.Now you've got the /api invoked, but no DB write.