跳到主要内容

assignFileTemplates

assignFileTemplates(fileId, AssignMetadataTemplates)

PUT /api/2.0/files/metadata/file/{fileId}/templates

Assign templates to a file

Assigns one or more metadata templates to a file, so its fields can be filled with PUT api/2.0/files/metadata/file/{fileId}/values. The caller needs the right to edit the file. The assignment writes no values and is idempotent: a template the file already carries is skipped, the others are added, an empty list changes nothing. The call finishes in the request, nothing runs in the background. A template a cascading folder above the file already provides stays inherited. A file the caller cannot edit is answered with 403; a file, or a template, that does not exist with 404. To take a template off the file use DELETE api/2.0/files/metadata/file/{fileId}/templates/{templateId}.

Parameters​

NameInTypeDescriptionNotes
fileIdpathInteger (int32)The file ID.[required] [example: 1]
AssignMetadataTemplatesbodyAssignMetadataTemplatesThe parameters for assigning templates.[required]

Responses​

Status codeDescriptionTypeResponse headers
200OK-X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The request body cannot be read or has no templateIds--
403The caller cannot edit the file--
404The file or one of the templates does not exist--
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​

null (empty response body)

Authorization​

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

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json