views:

41

answers:

1

How to achieve itempotency when incrementing a database column via PUT? (For example a credits-count in a purchase process)

+4  A: 

Send a unique transaction id with every request, store all executed transaction ids and don't react to requests with a transaction id that you already saw.

Joachim Sauer
Jinx! I deleted mine, didn't add any value over yours.
T.J. Crowder
Ah, I think that's exaclty what we need. Are there any best practises / plugins for that?
metafoo
This way works, but if the increment is constant you lose that property. It will just work as you can increment by any amount or you have to do a validation and see if the id is correct
Diego Dias