Showing posts with label post once exactly. Show all posts
Showing posts with label post once exactly. Show all posts

Friday, June 18, 2010

RESTful POST Once Exactly (POE) variation

How do you control form POSTs from the client (browser) to the server to prevent a double-submit from being processed twice on the server?

Client : POST "/widget/" Expect: 100-continue []
Server : write new transaction id to db
Server response :
100 Continue, POE: {tranid}
Client : POST "/widget/" POE: {tranid} [body]
Server : POE {tranid} exist in db?
Server : delete {tranid}
Server : Create new resource from [body].
Server response :
201 Created, Location: {newuri} [body]
Client : ...