Search code examples
restterminology

Is duduping same as idempotency


It's clear for me what idempotence means based on this Defining Idempotence

But I also heard a lot people describe such behavior as deduping. Is that an equivalent terminology?

For example, if an API is idempotent that same request being processed for N times will get the state same as one time. Can I say that API is deduping requests?


Solution

  • The two terms are not equivalent, though it may be helpful for people unfamiliar with idempotency to think of it initially based on its similarity to deduplication.

    For a contrasting example, consider an API for a bank account which accepts a positive or negative number by which to adjust the account balance (deposit or withdrawal). Clearly this API is not idempotent, because consecutive transactions have a cumulative effect.

    On the other hand, we would certainly want to deduplicate these transactions. If transaction #123 is (erroneously) submitted twice, it should apply to the account balance only once. In this case, transactions should be deduplicated because the API is not idempotent.

    Deduplication is an activity: an action to perform. Idempotency is an attribute: a property to describe. A similarity exists between the two when the result of deduplication is the same as the effect of idempotency; that is, no change in state. But an equivalent outcome does not make the two terms equivalent.