Overview
Within the Nomba API, idempotency stands as a crucial shield against unintended outcomes resulting from duplicate requests. Although our system effectively manages idempotency, we advise that users interacting with specific endpoints such as those responsible for creating accounts or executing bank transfers, include an idempotency keyX-Idempotent-key
in their requests.
Understanding Idempotency
In the API landscape, an operation is termed idempotent if its results remain consistent, regardless of how frequently the operation is executed. Essentially, idempotency acts as a protective barrier against unintentional duplicate calls that could lead to unforeseen consequences. For instance, consider a scenario where idempotency is not enforced for the Bank Transfer endpoint in Nomba. A successfulBank Transfer
request is made, but a connection failure prevents confirmation. Uncertainty looms regarding the fate of the initial request, and if resent, it may inadvertently result in a duplicate disbursement.
To mitigate this risk, Nomba incorporates idempotency support by allowing API operations to include an idempotency key which is a unique string that guards against accidental duplicate calls.
Real-world Illustration
Nomba’s API provides a tangible illustration of idempotency in action, where operations can be accompanied by an idempotency key to prevent inadvertent duplicate calls and their potential adverse effects. Lets consider the earlierBank Transfer
example
Scenario 1
Repeating the sameBank Transfer
request with the same idempotency key prompts the endpoint to recognize it as a duplicate. Instead of processing the request again, the endpoint retrieves the response from the initial successful Bank Transfer
operation.
Scenario 2
Using the same idempotency key but altering theBank Transfer
request (e.g., specifying a different amount) results in an error, indicating previous usage of the idempotency key.