Appearance
PATCH
/communication/template-text/template-texts/{id}/locales/{locale}/attachments/{attachmentId}Required scope:
templatetext:updateChanges the file name, description, parameters, language id or article number format id of an attachment. Only the fields that are sent are changed (null or left out means unchanged, so languageId and skuFormatId cannot be cleared: remove the attachment and add it again); the parameters, when they are sent, replace all of them. The report cannot be changed: remove the attachment and add another. A file attachment has only a file name and a description: renaming it does not move the stored file, and the new name needs an allowed file type. The rows of the language are updated in the same all-or-nothing save.
Parameters ​
Path parameters
locale stringLocale code (e.g. 'sv', 'en').
attachmentId stringThe id of the attachment.
Request body ​
JSON
{
"parameters": {
"inorderno": "{inorderno}"
},
"fileName": "Purchase_order_{inorderno}.pdf",
"description": "Purchase order",
"languageId": 1,
"skuFormatId": 0
}
Response ​
The attachment after the change.
JSON
{
"id": "6f1c4c0e-2a53-4f5c-9d6a-0c3f6b1d7a11",
"kind": "REPORT",
"fileName": "Purchase_order_{inorderno}.pdf",
"description": "Purchase order",
"reportId": 10035,
"parameters": {
"inorderno": "{inorderno}"
},
"languageId": 1,
"skuFormatId": 0,
"size": 48213,
"contentType": "application/pdf"
}
| Error code | Description |
|---|---|
attachment-not-found | The language has no attachment with the id. |
attachments-not-supported | The template is an SMS or an invoicetext; only an e-mail can have attachments. |
duplicate-attachment-name | Another attachment of the language has the file name, in any case. |
file-type-not-allowed | The new file name of a file attachment does not have one of the allowed extensions. |
invalid-attachment-description | The description is blank or longer than 2000 characters. |
invalid-attachment-name | The file name is blank, longer than 255 characters, does not end with .pdf (a report) or has a character that a file name cannot have. |
invalid-report-parameter | A parameter name or value is not allowed, an id is negative, or the url would be longer than 512 characters. See the request that adds a report attachment. |
invalid-request | The attachment is a file and the request has parameters, languageId or skuFormatId. |
locale-not-found | The template does not have the locale. |
template-changed | Another request changed the template after it was read, so nothing was saved. Reload the template and try again. |
template-not-found | No template with the given code exists for the current company. |