Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Source keys

A sourceKey identifies a change your app asks ResourceShark to make, such as adding a delivery or committing the hold for an order. It lets ResourceShark recognize that change if your app sends it again with a different Idempotency-Key.

Repeating a change

ResourceShark keeps the source key with the work it records. Repeating the same request under that source key answers with duplicate: true without applying the change again. A repeated hold placement gives the original hold as it stands now. A different request that collides with the same source key answers duplicate_source. The refusal includes details about an earlier record only when the caller can read that record.

Each operation defines where a source key is unique. A supply entry’s key is unique on its resource. A hold’s placement key is unique in the project. A commit’s key is unique on each resource it takes from and shares that space with consume keys. These keys stay recorded after the request replay window ends, including after hold retention removes the hold’s details.

Idempotency keys

An Idempotency-Key identifies one HTTP request, where a source key identifies the change it asks for. Retrying a write has the rule for the header. ResourceShark’s own rules add that a retry repeats an error too, such as a shortage.

For example, a server retries an unanswered hold placement with both keys unchanged. After a shortage, it uses a new Idempotency-Key for the next attempt. It keeps the same sourceKey if the hold still represents the same change and the error left no hold behind.

Limits

A sourceKey is 1 to 200 characters after trimming. An Idempotency-Key is 1 to 255 characters after trimming.

Where to act on it