Write File Metadata

  • Writes metadata of a file stored in a File or FileList property.

  • Required security permission - MODIFY.

  • HTTP methods supported: POST.

Description

Some properties of an object may be allowed to store files. The files themselves are stored in a MongoDB GridFS bucket. The metadata of existing files can be set and modified using this endpoint. The metadata specification (a table schema) is documented together with the property whose metadata is modified.

On success, the endpoint returns the updated metadata.

Parameters

Name Type Optional Description

pathspec

string

no

The path or ID to the File or FileList property where the metadata is to be stored.

name

string

yes

The file name. Can be omitted if metadata.name is set or the property is of type File

metadata

JSON object

no

New or additional metadata for the file, see mode.

mode

string

yes

Indicates whether the existing metadata needs to be completely replaced (mode = 'replace') or merged with the provided metadata (mode = 'merge'). By default 'merge'.

scope_comment

string

yes

Audit trail comment.

insights

boolean

yes

Indicates application insights should be included in the response, by default false.

Examples

Write metadata to a FileList property

This example shows how to write metadata of a file to a FileList property

HTTP POST

Request URL
  • /api/v2/writefilemetadata

Request body
{
    "pathspec": "/Enterprise.Attachments",
    "name": "example.ico",
    "mode": "replace",
    "metadata": {
        "custom": {
            "scheme": "dark"
        }
    }
}
Response body
{
    "data": {
        "_dbref": "8b18c8da9355e38daf6c935b4921d2ad8b2ef1cac4c2fbeebfd8af9946a91574",
        "custom": {
            "scheme": "dark"
        }
        "dateuploaded": 1622758226545,
        "extension": "svg",
        "name": "example.svg",
        "size": 2149
    }
}