Upsert one language of a draft
/v1/email/templates/{template_ref}/versions/{version_id}/languages/{language}bird email templates versions languages set <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 }}!'curl -X PUT "https://us1.platform.bird.com/v1/email/templates/{template_ref}/versions/{version_id}/languages/{language}" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"subject": "Welcome to Acme, {{ bird.contact.first_name }}!",
"preview_text": "{{ bird.contact.first_name }}, your order is on its way",
"html": "<h1>Hi {{ bird.contact.first_name }}</h1>"
}'{
"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"
]
}
]
}
]
}
Saves one language's content on the template's draft, creating that language if the draft does not have it yet and replacing it in full if it does. Send the same content twice and the draft ends up the same way, so a sync job or CI run needs one call rather than a create-or-edit decision.
Saving one language leaves every other language untouched, so a template with many languages can be edited a language at a time. Send the revision you last read to have a concurrent edit rejected with a 409 conflict_error instead of silently overwritten.
Only a draft can be saved: addressing a published version returns a 422 validation_error, because a published version never changes. A template holds at most 25 languages.
Paramètres
template_refstringThe 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_idstringlanguagestringCorps de la requête
subjectThe email subject line. It may be empty in a draft but is required to publish.
preview_textThe line an inbox shows after the subject in the message list. Leave it out and the inbox shows the opening words of the body instead.
htmlThe HTML body for this language.
textThe plain-text body for this language. Omit it and a plain-text alternative is derived from the HTML when you submit.
revisionThe revision you last read for this language, to detect a concurrent edit. The save is rejected with a conflict if the language moved on since. Omit it to save unconditionally. Creating a language does not need one.
Contenu de la réponse
languageThe language that was saved, in its canonical form. Send a tag in any casing and this reports the form the template stores.
revisionThis 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_revisionThe 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_hashA 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_atWhen this language was saved.
template_refThe template this save addressed.
version_idThe draft this save wrote to.
compatibility_severityThe 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 aproblem.warning: every finding is awarning.none: there are no findings.
Possible values: problem, warning, none
nextWhat 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.
compatibilityWhat 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.
Ressources associées
Poursuivez avec la documentation, les guides et les exemples sur ce sujet.