templates

Update template content

Replaces the body of a template. The name, type and structured-template link are unchanged and cannot be edited through this API. The previous body is kept in the template's history in Vetnio.

The change applies to every future generation that uses the template, for every user of the clinic; records generated earlier are not rewritten.

Who may update: the template's creator, clinic admins, and, when the clinic's template permissions are Full Access, members for other members' templates that are not managed. Others get 403, as does any attempt to update a Vetnio default template (duplicate it first). A template the caller cannot see returns 404. A stale expectedContentVersion returns 409. Requires a personal API key.

put/workspaces/{workspaceId}/templates/{templateId}

Request

  • Base URL
    https://vetnio.com/api/v2
  • URL
    https://vetnio.com/api/v2/workspaces/{workspaceId}/templates/{templateId}
  • Auth
    HTTP bearer

Path parameters

workspaceIdstring required

Identifier of the clinic (workspace), as returned by GET /workspaces. The key's user must be a member of the clinic, or an admin of the organization it belongs to.

Example:furunculotic-loud-chihuahua
templateIdstring required

ID of the template (a UUID), as returned by List templates or Create a template. The template must belong to the workspace in the path and be visible to the caller under the clinic's template permissions; otherwise the request returns 404.

Example:3f6c2a1e-8b4d-4c7a-9e21-5d0b7f9a6c13

Request body

templatestring required

The complete new template body, in the same format as when creating a template (headings with instructions in parentheses; HTML or plain text). It replaces the current body entirely. Unsafe markup is removed before saving.

expectedContentVersionstring nullable

Optimistic-concurrency guard: the contentVersion returned by your previous update of this template, sent unchanged including its double quotes. If the template body has changed since then, the update is rejected with 409 and nothing is saved. Omit it or pass null to overwrite unconditionally.

Example request

{
  "template": "<p><strong>Reason for visit</strong></p><p>(Summarize the reason for the visit in one sentence.)</p><p><strong>Plan</strong></p><p>(List only the actions actually discussed, one bullet per action. If no plan is recorded, write \"Not recorded\".)</p>",
  "expectedContentVersion": "\"9b2cf535f27731c974343645a3985328\""
}

Response

The new body was saved; contentVersion identifies it.

successboolean required

Always true when the request succeeds; failures are returned as an HTTP error status instead.

contentVersionstring nullable

Opaque version tag of the content you just saved, including its surrounding double quotes. Send it unchanged as expectedContentVersion on your next update so that the update fails with 409 if someone else changed the template in between. null if storage did not return one.

Example response

{
  "success": true,
  "contentVersion": "\"9b2cf535f27731c974343645a3985328\""
}

Changes

No recorded changes to this operation across all 1 revision of this API.