How can I know if I trigger the create transaction API isn't this a duplicate call? #1972
-
|
Hi, my business case is this: my client needs out to send 500 USD I searched Blnk ledger, when a duplicate call happened, it shows this error "duplicate reference" error you might argue, we shouldn't return an error, but atleast this is very much safer and easy to handle than have a response which I wouldn't know if it's a duplicate or not |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Hi @BinMunawir Add Idempotency-Key in the header of the request; the system will skip your request processing and return a success directly should you execute the same request twice The feature is applied on endpoints which write to the database :
When requesting the service with a IK, if the IK has already been used on another request terminated with success (Status code 2XX), the same response will be returned, plus a header named "Idempotency-Hit" with the value "true". Given a IK, if the request does not match the originated request, either if the path or the body does not match, the service will responds with a 400 status code. The scope of the idempotency keys is bound to a specific ledger. Therefore a same IK can be used on two differents ledgers without triggering any alert. Other option -> use |
Beta Was this translation helpful? Give feedback.
-
|
to simplify my question, how can I differentiate between first-request and subsequent-request when I create a transaction from the API? thanks @aalloiteau for your reply, two points I have
|
Beta Was this translation helpful? Give feedback.
Hi @BinMunawir , for your information Idempotency-Hit was added back here released in v2.3.6