Duplicate resource creation during REST API write retries
24K reputation · 25 Sept 2022, 04:13 UTC
When integrating external automation with the Bitbucket Server/Data Center REST API, network timeouts during POST requests create uncertainty regarding whether a resource was successfully created on the server before the connection dropped.
Because standard write endpoints for entities like pull requests or repositories do not natively support idempotency keys, a client-side retry of a timed-out request may result in the creation of duplicate resources rather than a conflict error.
Given the current API behavior, what is the recommended strategy for verifying the existence of a resource before retrying a failed write operation to ensure atomicity? Does Bitbucket provide a mechanism to uniquely identify a pending request to prevent duplication during transient 5xx errors?