An attachment uploaded via the API is accompanied by a Content-Type header, which specifies the file type. The server enforces two conditions on its content — and the earlier 50-character limit no longer applies, so long Office format types can now be given in full.
Rules for the value
Rule | What happens if it's not met |
The value must be in the form | A value without a slash results in a |
The value may be at most 127 characters long. | From 128 characters onward, the request fails with a |
The header does not need to be specified. | The attachment is saved with the type |
The stored value is returned in the Content-Type header when you download the attachment via the /prilohy/{ID}/content address — so it's important that it's filled in correctly, to ensure the file opens in the right application.
Types for office formats
Standard Office file types easily fit within the 127-character limit (the longest one has 73 characters):
File | Content-Type |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
🚨 Shortened forms such as vnd.ms-word.document.macroEnabled.12, which used to be recommended as a workaround for the 50-character limit, now result in a 500 error — they're missing the slash. Moreover, they denote a different format (files with macros). Therefore, use the full form with the application/ prefix; if you need the type for a macro-enabled format, it's application/vnd.ms-word.document.macroEnabled.12.
