Appearance
POST
/communication/template-text/template-texts/{id}/renderedRequired scope:
templatetext:readRenders content that has not been saved exactly like GET /rendered renders the saved template, for the editor while the form has unsaved changes. Nothing is stored: no write, no history entry, no projection, and no check that the template has changed. A field that is left out uses the stored template; a field that is sent replaces the stored one as a whole, like a PUT. The body and the translation values are cleaned like a save cleans them. The source locale, the settings and the usage type are always the stored ones. The body of a save (PUT) can be sent as it is with locale and country added: the fields that a preview does not use are ignored. Only mistakes are refused, not what is incomplete: a language without a subject or translations falls back to the source locale, and a token without a translation is returned in unresolvedTokens. The countries of the request (country settings, country blocks) are not looked up and appear in countries as they are; only the requested country must be in the company's country table, or be OTHER. The countries of the response are those of the unsaved content.
Request body ​
JSON
{
"locale": "sv",
"country": "FI",
"canonicalBody": "<p>{t_greeting} {customerName}</p>",
"locales": [
"sv",
"en"
],
"translations": {
"sv": {
"t_greeting": "Hej"
}
},
"subjects": {
"sv": "Din order"
},
"senderNames": {
"sv": "Viskan"
},
"senderEmails": {
"sv": "no-reply@viskan.se"
},
"countrySettings": {
"FI": {
"senderName": "Viskan Finland",
"subjects": {
"sv": "Din order i Finland"
}
}
}
}
Response ​
The rendered preview of the unsaved content.
JSON
{
"body": "<p>Hej Test Customer</p>",
"contentType": "text/html",
"subject": "Din order",
"senderName": "Viskan",
"senderEmail": "no-reply@viskan.se",
"unresolvedTokens": [
"customerName"
],
"country": "SE",
"countries": [
"FI",
"NO"
]
}
| Error code | Description |
|---|---|
ambiguous-country | The requested country code matches more than one country in the company's country table. |
country-block-in-subject | A subject, also that of a country, has a country block; they are only allowed in the body. |
invalid-bcc | A bcc, also one of a country, has a control character (such as a line break), or is not an e-mail address or a list of them separated by ';' or ',' (empty means none). |
invalid-bcc-length | A bcc, also one of a country, is longer than 60 characters. |
invalid-body-size | canonicalBody is longer than 2097152 characters. |
invalid-cc | A cc, also one of a country, has a control character (such as a line break), or is not an e-mail address or a list of them separated by ';' or ',' (empty means none). |
invalid-cc-length | A cc, also one of a country, is longer than 60 characters. |
invalid-country-settings | A key of countrySettings is blank, OTHER or a country that is there twice, or a country has no settings object. |
invalid-request | locale is null or blank, or translations has a null value. |
invalid-sender-email | A sender email address, also one of a country, has a control character (such as a line break), or is not an e-mail address or a list of them separated by ';' or ',' (empty means none). |
invalid-sender-email-length | A sender email address, also one of a country, is longer than 60 characters. |
invalid-sender-name | A sender name, also one of a country, has a control character (such as a line break). |
invalid-sender-name-length | A sender name, also one of a country, is longer than 60 characters. |
invalid-subject | A subject, also one of a country, has a control character (such as a line break) or is longer than 500 characters. |
invalid-translation-size | A translation value is longer than 65536 characters. |
language-not-found | A language of locales is not in the supported 1:1 language↔country map. |
locale-not-found | The requested locale is not one of the locales of the unsaved content, or a country setting has a subject for a locale that is not. |
not-supported-for-usage-type | The request has a subject, sender name, sender email or country settings for an invoicetext, which has none. |
repeat-block-not-supported | The body or a translation has a repeat block for an invoicetext, which has none. |
template-not-found | No template with the given code exists for the current company. |
unknown-country | The requested country is not in the company's country table. |