Generated from Postwind commit a19b2e4 OpenAPI 0.1.0 synced

Templates HTTP API

PUT/api/v1/projects/{project_id}/templates/{template_id}

update_template

Saves a new version of a template: its latest version’s number plus one, with the sources given; the name and kind stay.

Call it
to change a template; campaigns already launched keep the version they took.
Needs
an admin key with project_id, or a project key with scope write (its own project; the argument is ignored), and sources that pass the checks of create_template. A new version of a partial is checked on its own; the messages that include it take it at their next render and are refused then if it breaks them.
Returns
the new version, the same as PUT /api/v1/projects/{project_id}/templates/{template_id}.

Arguments

  • object
  • html_bodystringrequired

    The HTML body of the new version.

  • template_idstring · uuidrequired

    The template’s id, as create_template or list_templates gave it.

  • project_idstring · uuid | null

    The template’s project. An admin key must pass it; a project key’s own project is used and this is ignored.

  • subjectstring | null

    The subject of the new version.

  • text_bodystring | null

    The text body of the new version; null or left out: made from the HTML.

No other arguments are accepted.

Result

The result comes back as structuredContent, with the same JSON as a text block.

  • object · all fields required
  • created_atstring · date-time

    When this version was saved.

  • The template engine.

    • minijinja
  • html_bodystring
  • idstring · uuid

    The template’s id, the same in every version.

  • What a template is.

    message A message: subject, HTML, text.

    partial A fragment other templates include.

  • namestring
  • project_idstring · uuid
  • subjectstring | null

    null for a partial.

  • text_bodystring | null

    null: the text is made from the HTML when the message is sent.

  • versioninteger · uint32

    From 1, one more at each save.

    ≥ 0

Definitions

EngineOutput

The template engine.

string · enum

  • minijinja

TemplateKindOutput

What a template is.

string · enum

message A message: subject, HTML, text.

partial A fragment other templates include.

Errors

A failed call answers isError: true with a code from the same table as the HTTP API, and detail. How tools report errors

HTTP API

The same operation over HTTP: PUT /api/v1/projects/{project_id}/templates/{template_id}