Top
Best
New

Posted by ludovicianul 3 days ago

Idempotency Is Easy Until the Second Request Is Different(blog.dochia.dev)
72 points | 31 commentspage 2
WilcoKruijer 1 hour ago|
I really hate the POST verb for RESTish APIs because it cannot be idempotent without implementing an idempotency layer. Other verbs are naturally idempotent. Has anyone tried foregoing POST routes entirely? Theoretically you can let the client generate an ID and have it request a PUT route to create new entities. This would give you a tiny amount of extra complexity on the client, but make the server simpler as a trade-off.
mrkeen 21 minutes ago|
In what sense is GET naturally idempotent?

The GET/POST split is the defence (even it's only advisory).

GET-only means every time you hit the back button during an order flow, you might double-order.

randallsquared 10 minutes ago||
GET is not supposed to make changes on the server. The usual idempotent verbs for making changes are PUT and DELETE.

One thing that's confusing, here, is that idempotency only applies for the same request, but the article implies that idempotency is about whether the request contains a specific "idempotency key".

Don't do that, and this problem evaporates.

stavros 2 hours ago||
Half of the mentioned issues are issues of atomicity, not idempotency. If I make a request, and the server crashes midway and doesn't send some crucial events, that's an issue whether or not I send a second request.

From a cursory read, only the part up to "what if the second request comes while the first is running" is an idempotency problem, in which case all subsequent responses need to wait until the first one is generated.

Everything else is an atomicity issue, which is fine, let's just call it what it is.

asdfaoeu 26 minutes ago||
Tbh the article seems to just be like "you can't solve idempotency with one idempotency-key header" and well like no shit.
behaviors 1 hour ago|||
If the atomic action is idempotent, you don't need a layer for repeating yourself. You hit the nail on the head. So much idempotency efforts are made because they never made the actions idempotent in the first place.
adamvendel 1 hour ago||
[dead]
villgax 1 hour ago|
skill issue lol, it's not idempotent anymore, same key for different requests? Heard of a nonce?