Simple Reliable POSTing

, Jun 16, 2007

Joe Gregorio:

[I]nstead of creating a ticket that goes into the data to be submitted, we can use the ticket to construct a ‘pending_order’, the URI of which the client will PUT the order to. Upon a successful PUT the pending_order will be moved to the open_orders collection and the client can be redirected to its location via a (303 See Other) response. […] This is better since PUT is idempotent and you can keep trying until the request is successful. Once the PUT is successful the client is redirected to get the newly created resource via GET from the URI returned in the Location: header of the response.

Very simple and elegant solution.

Go read the whole thing, it’s great; I’ll write up something longer about it for InfoQ.

On June 16, 2007 11:46 PM, Aristotle Pagaltzis said:

You got caught out by Markdown: Markdown thinks you want to emphasise the run of text between the underscores in the two mentions of pending_order in your quote. You need to either put pending_order in backticks or backslash the underscore.

On June 17, 2007 9:21 AM, Stefan Tilkov said:

Thanks, fixed.