Read File Metadata

  • Retrieves metadata of files stored in one or different File or FileList properties.

  • Required security permission - READ.

  • HTTP methods supported: GET, 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 retrieved using this endpoint.

This endpoint allows to read metadata of files which are stored in one or different File or FileList properties of a single or different objects.

Parameters

Name Type Optional Description

identifier

string

no

The path or ID of the file property to be queried for file metadata.

filter

string

yes

A filter specification to lookup a file which is stored in a File or FileList property. Must be a string containing the name or a Base64 encoded JSON dictionary. See the getfilemetadata Lua function for details.

prev

number or string

yes

A filter can have an optional start value 'prev' which is typically the metatable obtained from a previous call to continue iterating over all matching entries. It may also be an integral row index (negative values are relative to the last row, i.e. specifying -2 returns the last table row if it matches). Must be a number or a Base64 encoded JSON dictionary.

insights

boolean

yes

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

Filtering

In the body of a POST request the filter and prev parameters can be defined on root level to specify a global filter for the provided items. For each item the global filter and or prev parameter can be overruled.

Global filter applied to every item

{
    "filter": {
        "extension" : "pdf"
    },
    "items": [
        {
            "p": "/Enterprise.Attachments"
        },
        {
            "p": "/Enterprise/Site01.Attachments"
        }
    ]
}

Global filter applied to the first to items and overruled by the third item

{
    "filter": {
        "extension" : "pdf"
    },
    "items": [
        {
            "p": "/Enterprise.Attachments"
        },
        {
            "p": "/Enterprise/SiteNL.Attachments"
        },
        {
            "p": "/Enterprise/SiteNL/Area01.Attachments",
            "filter": {
                "extension" : "svg"
            },
        }
    ]
}

Examples

Read metadata by filename stored in a FileList property

This example shows how to retrieve metadata for one single file.

HTTP GET

Request URL
  • /api/v2/readfilemetadata?identifier=/Enterprise.Attachments&filter=example.svg

Response body
{
    "data": {
        "items": [
            {
                "i": 281475660316684,
                "metadata": {
                    "_dbref": "fa1be40fa2382ae1f99081651c51880c3a1161def6aa0e50948acb41cb576138",
                    "custom": {
                        "lorem": "ipsum"
                    },
                    "dateuploaded": 1622749409175,
                    "extension": "svg",
                    "name": "example.svg",
                    "size": 5458
                },
                "p": "/Enterprise.Attachments"
            }
        ]
    }
}

HTTP POST

Request URL
  • /api/v2/readfilemetadata

Request body
{
    "filter": "example.svg",
    "items": [
        {
            "p": "/Enterprise.Attachments"
        }
    ]
}
Response body
{
    "data": {
        "items": [
            {
                "i": 281475660316684,
                "metadata": {
                    "_dbref": "fa1be40fa2382ae1f99081651c51880c3a1161def6aa0e50948acb41cb576138",
                    "custom": {
                        "lorem": "ipsum"
                    },
                    "dateuploaded": 1622749409175,
                    "extension": "svg",
                    "name": "example.svg",
                    "size": 5458
                },
                "p": "/Enterprise.Attachments"
            }
        ]
    }
}