跳到主要内容

setFileCustomFields

CustomFieldValueArrayWrapper setFileCustomFields(fileId, SetCustomFields)

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

Set file custom fields

Sets the custom text fields of a file: free-form name and value pairs that need no template. The caller needs the right to edit the file. A field is addressed by its name regardless of case: a listed name gets the value, a null or empty value removes the field from the file, the names not listed are left alone, so a partial request is safe. A name the portal has not seen yet creates the field for the whole portal, and a name no entry holds a value for any more is dropped, so the set of names follows the values. A name is at most 255 characters, a value at most 8000, a name may be listed once and a file holds at most 50 custom fields. The write finishes in the request; the values take part in the free text search and in the metadataFilters of the listings. The answer is the custom fields of the file after the write. An empty list, a blank, repeated or over-long name, an over-long value or more than 50 fields is answered with 400; a file the caller cannot edit with 403; a file that does not exist with 404.

Parameters​

NameInTypeDescriptionNotes
fileIdpathInteger (int32)The file ID.[required] [example: 1]
SetCustomFieldsbodySetCustomFieldsThe custom fields to set.[required]

Responses​

Status codeDescriptionTypeResponse headers
200The custom fields of the file with their valuesCustomFieldValueArrayWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400Invalid custom fields or too many of them--
403You don't have enough permission to perform the operation--
404File 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​

CustomFieldValueArrayWrapper

Authorization​

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

HTTP request headers​

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