Youniton Docs

Versioning & If-Match

The API has a major version in the URL, and each changeable record has its own version for safe concurrent writes.

#The API version

The major version is in the URL: /api/v1. The current contract is 1.0.0-baseline.

#Changes that can come within v1

  • new operations;
  • new optional request members and new response members — ignore members that you do not know;
  • new problem codes for new situations;
  • new values of enumerations that the contract marks x-extensible-enum — accept values that you do not know.

#Breaking changes

Youniton does not do these in v1: remove or rename an operation, a member or an enumeration value; change a type, a format or a meaning; make optional input required; tighten a constraint; change a default sort or page size; change the status or code of an existing situation; require a new ability.

#Deprecation

A public operation that will go has deprecated: true in the contract and sends the headers Deprecation, Sunset and Link: <…>; rel="deprecation". There are at least six months between the deprecation and the sunset, and the changelog tells you.

#Record versions and If-Match

A changeable record has a version, for example a ticket, a worklog, a comment, a project, a client organisation, a contact, a message or a memory entry.

  1. #Read the record

    A read of one record sends a strong ETag with its version. List rows carry version.

    Response headers
    HTTP/1.1 200 OK
    ETag: "12"
  2. #Send the version with your change

    PATCH with If-Match
    curl -s -X PATCH "$YOUNITON_API/tickets/ORB-124" \
      -H "Authorization: Bearer $YOUNITON_TOKEN" \
      -H "Content-Type: application/merge-patch+json" \
      -H 'If-Match: "12"' \
      --data '{"title": "Design the approval flow"}'
  3. #Handle a stale version

    When someone changed the record after your read, the answer is 412 stale-version with currentVersion. Nothing changes. Read the record again, apply your change and send it with the new version.

RuleDetail
required onPATCH, a PUT of a sub-resource (client visibility, settings, policies) and a DELETE of a versioned record
missing428 precondition.required
different412 stale-version with currentVersion
not acceptedIf-Match: *
optionalthe ticket position command and the memory upsert by path: with the header, Youniton compares; without it, it does not
not neededcreates and state commands such as submit or withdraw — the state check answers 409 …invalid_state

The comparison and the write are one conditional update, so there is no gap between the check and the write. The reference shows an If-Match chip on each operation that needs it.

Was this helpful?