跳到主要内容

updateField

MetadataFieldWrapper updateField(templateId, fieldId, UpdateMetadataFieldRequest)

PUT /api/2.0/files/metadata/templates/{templateId}/fields/{fieldId}

Update a metadata field

Changes the name, the type, the options or the display order of a metadata field. Only a DocSpace admin can change templates. The request is partial: a property left out keeps its value. The type can be changed only while no entry holds a value for the field, and an option can be removed only while no entry has selected it; a new option is sent without an identifier and gets one in the answer. A new name must be unique within the template regardless of case. The values already written are left as they are. The field is addressed through its own template: a field reached through another template's route is answered with 404, the same as a field that does not exist. A conflicting name, a type change on a field with values or the removal of an option in use is answered with 400.

Parameters​

NameInTypeDescriptionNotes
templateIdpathInteger (int32)The template ID.[required] [example: 1]
fieldIdpathInteger (int32)The field ID.[required] [example: 1]
UpdateMetadataFieldRequestbodyUpdateMetadataFieldRequestThe parameters of the field update.[required]

Responses​

Status codeDescriptionTypeResponse headers
200Updated metadata fieldMetadataFieldWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400Invalid field, a name another field of the template has, a type change on a field with values or the removal of an option in use--
403You don't have enough permission to perform the operation--
404Field not found--
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​

MetadataFieldWrapper

Authorization​

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

HTTP request headers​

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