Idempotency-Key
header. Although the idempotency key is not required, it is strongly recommended for all POST
or PATCH
requests. Sending idempotency keys in GET
or DELETE
requests has no effect as these requests are idempotent by definition. The server will then use this identifier to ensure that the same request is not executed multiple times.
Maple’s idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeedes or fails. Subsequent requests with the same key return the same result, including 400 and 500 errors.
Once the API request is received by the server, the server will check if the identifier is valid and has not been used before. If the identifier is valid and has not been used before, the server will process the request and mark the identifier as used. If the identifier is not valid or has been used before, the server will ignore the request and return the response from the previous request.
You can safely retry requests that include an idempotency key within 24 hours. Once the key expires, Maple will execute those requests again.
For example, you can use an idempotency header to prevent duplication while creating customers in Maple.
Idempotency-Key
header in the response to ensure that there is clarity on the key being used.
Maple will also include Idempotency-Used: true
in the response to show that a previous response is being replayed.