跳到主要内容

uploadDefaultTemplate

DefaultTemplateSettingsWrapper uploadDefaultTemplate(fileExtension, file)

POST /api/2.0/files/settings/defaulttemplate

Upload a file as the default template setting

Uploads a document and makes it the blank the portal creates for one extension, and returns the full set of templates as it now stands. The request is multipart form data carrying the file, while the extension travels in the FileExtension query parameter; the extension of the uploaded file name must be exactly that one, or the call answers 403. A PDF is additionally checked to be a fillable form, and answers 403 as well when it is not one. The upload is capped at 100 MB and a larger body answers 400 while it is still streaming in. The file is stored in the portal's template storage and the file that served as the previous custom blank for that extension is deleted; an extension the built-in template set does not cover leaves everything unchanged. Requires the portal settings permission. Use PUT api/2.0/files/settings/defaulttemplate to reuse a document that is already in the portal.

Parameters​

NameInTypeDescriptionNotes
fileExtensionqueryStringThe extension the uploaded blank is set for, written in lower case with the leading dot, and travelling in the query string rather than in the form. It must match the extension of the uploaded file name. Only the extensions the portal's built-in template set covers are accepted, and GET api/2.0/files/settings/defaulttemplate returns exactly that list; an extension outside it leaves the settings unchanged instead of failing.[required] [example: .docx]
fileformFile (binary)The template document itself. Its file name must end with the extension named above, a PDF must be a fillable form, and the body is capped at 100 MB - a larger one is refused while it is still streaming in.[required]

Responses​

Status codeDescriptionTypeResponse headers
200The blank document configured for each supported extension after the uploadDefaultTemplateSettingsWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The uploaded file is missing or larger than the 100 MB limit, or its file name does not end with the requested extension--
403The caller has no portal-settings right, or the uploaded PDF is not a fillable form--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

DefaultTemplateSettingsWrapper

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: multipart/form-data
  • Accept: application/json