Sign inGet Started

Update one language of a draft

PATCH
/v1/email/templates/{template_ref}/versions/{version_id}/languages/{language}
bird email templates versions languages update <template-ref> <version-id> <language> \
  --html '<h1>Hi {{ bird.contact.first_name }}</h1>' \
  --preview-text '{{ bird.contact.first_name }}, your order is on its way' \
  --subject 'Welcome to Acme, {{ bird.contact.first_name }}!'
响应200
{
  "language": "pt-BR",
  "content_hash": "sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
  "template_ref": "emt_01krdgeqcxet5s7t44vh8rt9mg",
  "version_id": "emv_01krdgeqcxet5s7t44vh8rt9mg",
  "compatibility_severity": "warning",
  "next": [
    {
      "kind": "operation"
    }
  ],
  "compatibility": [
    {
      "rule_id": "css_display_flex_grid",
      "severity": "warning",
      "language": "pt-BR",
      "field": "html",
      "message": "`display: flex` and `grid` don't work in Outlook (Windows/Windows Mail).",
      "fix": "Use tables for layout.",
      "partial": "Partial support for `display: flex` and `grid` in Gmail (iOS/Android).",
      "line": 14,
      "column": 6,
      "match": "display: flex",
      "unsupported_clients": [
        {
          "family": "outlook",
          "platforms": [
            "windows",
            "windows_mail"
          ]
        }
      ],
      "partial_clients": [
        {
          "family": "outlook",
          "platforms": [
            "windows",
            "windows_mail"
          ]
        }
      ]
    }
  ]
}

Changes part of one language's content on the template's draft: send only the fields you are changing and the rest keep their current values. Use this to fix a subject line without resending a megabyte of HTML.

The language must already exist on the draft. A language it does not have returns a 404 not_found_error. Save the language's full content instead to create it.

Send the revision you last read to have a concurrent edit rejected with a 409 conflict_error. Only a draft can be edited. Addressing a published version returns a 422 validation_error.

参数

template_refstring

The template's id (emt_…) or slug. On read, a built-in system template's bird_ slug also resolves here. Writing or removing a language requires a workspace template, because a system template has no draft to edit and returns 404 not_found_error.

version_idstring

The version that holds the language.

languagestring

The language as a BCP-47 tag.

请求载荷

subject
string

The email subject line. It may be empty in a draft but is required to publish.

preview_text
nullable string

A new line for the inbox to show after the subject in the message list. Send null to clear it, and the inbox shows the opening words of the body instead.

html
string

A new HTML body for this language.

text
nullable string

A new plain-text body for this language. Send null to clear it, and a plain-text alternative is derived from the HTML when you submit.

revision
integer

The revision you last read for this language, to detect a concurrent edit. The edit is rejected with a conflict if the language moved on since. Omit it to apply the edit unconditionally.

响应载荷

language
string
必填

The language that was saved, in its canonical form. Send a tag in any casing and this reports the form the template stores.

revision
integer
必填

This language's new revision. Send it back on your next save of this language so a concurrent edit is caught instead of silently overwritten.

draft_revision
integer
必填

The draft's new revision. Saving a language moves it, so any template update you make next must send this value instead of the revision you read before the save.

content_hash
nullable string

A hash over the language's content as saved, prefixed with the algorithm that produced it (sha256:), so the algorithm can change without the field becoming ambiguous. It tells you whether a language differs without transferring the content, and is comparable only within one version of this API.

updated_at
nullable string

When this language was saved.

template_ref
string
必填

The template this save addressed.

version_id
string
必填

The draft this save wrote to.

compatibility_severity
string
必填

The worst severity across every finding the response was computed from, which is the authoritative reading: a response that caps how many findings it lists still accounts here for the ones it left out. Each response's compatibility says which content it covered.

  • problem: at least one finding is a problem.
  • warning: every finding is a warning.
  • none: there are no findings.

Possible values: problem, warning, none

next
array of object

What to do next with this save. Present on reads that compute it: an empty list means there is nothing to do, and the field is absent entirely on responses that do not report next actions.

A problem in compatibility routes back to this same write, with the identifiers to address it already on this response; a warning says what degrades and leaves the draft as it is.

显示子属性
next.kind
string
必填

What you do about this step.

  • operation: call the operation named in operation, then read again.
  • external: act somewhere this API does not reach, then read again.
  • wait: nothing is asked of you, so read again later.
  • terminal: nothing you do resolves this, so stop retrying.

Tolerate a value you do not recognize: show the description and offer no action.

Possible values (may grow over time): operation, external, wait, terminal

next.description
string
必填

A short, human-readable label for the step, suitable for display.

next.operation
string

The operationId to call. Present only when kind is operation. The operation's own schema says how to call it; this says only which one, and what to address it with.

next.params
object

The parameters that address the operation, by name: {"sender_id": "…"} for an operation on /v1/sms/senders/{sender_id}/requirements. A parameter the operation takes in its query string is given the same way, so an operation addressed as ?subject_id= carries {"subject_id": "…"}. Every parameter the call needs is here, whether its value came from the thing you were acting on or is fixed for this step, so you can make the call from this object alone. Present only when kind is operation and the operation names a subject. A request body, when the operation takes one, is described by the operation's own schema and never appears here.

next.url
string

A URL to open. Present only when kind is external, and only when the step has one. An external step whose description says to go and do something with no URL to open is normal.

compatibility
array of object
必填

What the HTML you just saved uses that mail clients remove, ignore, or render inconsistently, in the order the patterns appear. Empty when nothing is worth reporting. Advisory: the language was saved either way, and a finding never refuses a write. Line and column count in the HTML as saved, which the language read returns as content.html. A partial update reports on the language in full rather than on the fields it carried, so it reads the same as the read of the same language. At most 200 findings come back, the first 200 in source order; compatibility_severity is derived from every finding the HTML produced, including any beyond those 200.

显示子属性