Posts

Showing posts with the label idempotency

Idempotency

Image
Intent Idempotency , or idempotence , is a mesmerising word the first time you come across it. It is a concept rooted from abstract algebra in mathematics. Even though it may help understanding from a mathematical perspective, idempotency can be simply put as: The net result of multiple applications of the same method remains the same. Why is idempotency important, or relevant at all for RESTful APIs ? First, let us start by inspecting a real world example. Imagine an online payment scenario, the website suddenly becomes unresponsive and you have no idea if the payment you just made was successful or not. The temptation is to keep pressing the payment button, despite being advised not to. Soon you will find yourself swarmed by deliveries and a long bill.  Because networks are fundamentally unreliable in a distributed world , disruptions to connections will happen. In the circumstances that an API consumer sends a request but is unable to receive a response, it is impossible for the...