ShotGrid API: Configuring Idempotent Create Operations to Avoid Duplicate Writes
0 reputation · 26 Apr 2023, 19:39 UTC
Goal
Ensure that a retry of a ShotGrid create request after a network timeout does not result in duplicate entity records.
Constraints and Uncertainty
The ShotGrid REST API does not provide server‑side idempotency keys for POST‑based create operations, and the Python wrapper does not expose a built‑in mechanism to suppress retries that would cause duplicates. A common client‑side pattern is to generate a unique identifier and store it in a custom field, then query for an existing record before issuing a create. However, this approach introduces race conditions, requires read permission on the custom field, and may add extra API calls that affect rate limits.
- What is a reliable method to generate and attach a unique identifier that can be used as an idempotency key without violating ShotGrid schema constraints?
- How can a client safely check for an existing entity using that identifier while minimizing the risk of race conditions and staying within API rate‑limit thresholds?
- Are there any permission or schema‑design considerations when using a custom field for idempotency look‑ups versus relying solely on the create call?