Youniton Docs

Idempotency

Retry a call safely. A creating POST takes an Idempotency-Key; some records also take your own external reference or a path.

#Idempotency-Key

Every POST that creates a record or runs a command needs the header Idempotency-Key. Make one key per intent and send the same key on each retry of that intent.

A create with a key
KEY=$(uuidgen)   # one key per intent; keep it for the retries
curl -s -X POST "$YOUNITON_API/projects/ORB/tickets" \
  -H "Authorization: Bearer $YOUNITON_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $KEY" \
  --data '{"title": "Secure document links"}'
SituationAnswer
no key on an operation that needs one400 idempotency.key_required
the same key and the same request, after the first call committedthe original status with Idempotent-Replayed: true. Youniton builds the answer again with your current access.
the same key with a different request422 idempotency.key_reused
the same key while the first call still runs409 idempotency.in_flight with Retry-After: 1
the first call failed (4xx, 5xx, 401, 428, 429)nothing is stored; a retry with the same key is decided again
  • A key has 8–128 characters from A–Z a–z 0–9 . _ : -. A UUID is a good key.
  • A key is scoped to the tenant, the caller and the operation. Two callers with one key make two unrelated requests.
  • Youniton keeps a receipt for at least 24 hours after the call. Retry within that time.
  • The receipt is saved in the same transaction as the change, so a crash cannot run the command two times.

The reference shows an Idempotency-Key chip on each operation that needs it. PUT and DELETE are idempotent by their nature and take no key.

#External references

A help-desk create can carry your own id, externalReference (1–200 characters of A–Z a–z 0–9 . _ : / # -). It is unique per connection for ever, so a retry days later still finds the first request.

SituationAnswer
a new reference201 with the new request
a known reference and the same body200 with the existing request and Idempotent-Replayed: true
a known reference and another body409 help_desk_request.external_reference_exists with the existing requestKey

POST/help-desk/requests

#PUT by path

A memory entry has a path in its project. PUT/projects/{projectKey}/memory/entries/by-path creates the entry at the path or replaces its body. It is safe to repeat:

CallAnswermeta.outcome
the path is new201created
the same body again200unchanged — nothing changes
a new body200updated

If-Match is optional on this call. When you send it, the stored version must match. Read Write project memory.

#Webhooks

A webhook delivery from Youniton keeps one webhook-id over every retry. Store the ids that you processed and skip a repeat. Read Receive Youniton webhooks.

Was this helpful?