Idempotency
Idempotency in this API is achieved by using the optional Idempotency-Key header
How It Works
The value set in the Idempotency-Key header is a unique identifier for each request. When the server receives a request with a specific Idempotency-Key, it stores the result of that operation.
If a subsequent request with the same
Idempotency-Keyis received, the server will return the previously stored result without re-processing the operation.However, if the body does not match the first request HTTP error 422 will be returned
Method Examples
POST: If a POST request with an Idempotency-Key is sent to create a resource, only the first request will execute the creation. Subsequent requests with the same Idempotency-Key will return the result of the initial execution.
PUT: In a PUT request for updating a resource, the Idempotency-Key ensures that multiple requests with the same ID will maintain the resource’s state without reapplying the update.
Best Practices
- Always generate a new, unique
Idempotency-Keyfor each distinct operation to ensure proper idempotency handling. - Use universally unique identifiers (UUIDs) to minimize the risk of collisions.
- Ensure that the
Idempotency-Keyis included in every request where idempotency is required. - Idempotency keys are stored for 1 day
Updated 12 days ago
