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 can be used 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 is used to read metadata of files which are stored in one or different File or FileList properties of a single or different objects.
HTTP GET
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 |
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. |
Examples
The example below use a HTTP GET call to read the metadata of one or more files in the system.
-
Read file metadata by FileName
This example shows a
readfilemetadatarequest for a single file. Thefilterparameter is used to specify which file to return data for.Request URL:
/api/v2/readfilemetadata?identifier=/System/Core/GenericItem.Attachments&filter=example1.pngResponse Body:
{ "data": { "items": [ { "i": 281474986082351, "metadata": { "_dbref": "cfd3dfbc1c3c186a94f3a2d8ef8c3f2efbdc38e00bd2349dcac1af6c4f56e760", "custom": { "lorem": "ipsum" }, "dateuploaded": 1754485770303, "extension": "png", "name": "example1.png", "size": 894 }, "p": "/System/Core/GenericItem.Attachments" } ] } }
HTTP POST
Parameters
| Name | Type | Optional | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
body |
body |
no |
Read File Metadata RPC data
|
||||||
insights |
boolean |
yes |
Indicates application insights should be included in the response, by default false. |
Examples
In the examples below, a HTTP POST call is used to read the metadata of one or more files in the system.
-
Read file metadata
In this example, the
readfilemetadataendpoint is used to retrieve file metadata from the FileList property of two objects in the system.Request URL:
/api/v2/readfilemetadataRequest Body:
{ "items": [ { "p": "/System/Core/GenItem.Attachments" }, { "p": "/System/Core/GenItem2.Attachments" } ] }Response Body:
{ "data": { "items": [ { "i": 281475020423215, "metadata": { "_dbref": "cbb2d50bd9c870e0f098b9230d66d2f74d55544f2e57f1aabe3830443a040eb6", "custom": { "path": "C:\\Users\\Admin\\Documents\\test-file-2.txt" }, "dateuploaded": 1760007340759, "extension": "txt", "name": "test-file-2.txt", "size": 17 }, "p": "/System/Core/GenItem.Attachments" }, { "i": 281475020619823, "metadata": { "_dbref": "76fc1c80b77fc11d54abb5b973ceb4ca4c945ca591fe8199309bc5bd1e797c41", "custom": { "path": "C:\\Users\\Admin\\Downloads\\test-image.png" }, "dateuploaded": 1760010593551, "extension": "png", "name": "test-image.png", "size": 444 }, "p": "/System/Core/GenItem2.Attachments" } ] } } -
Read file metadata with filter parameter
This example shows a
readfilemetadatarequest using thefilterparameter to return the metadata for files with the '.txt' file extension. The second item in the response contains a error message as the object specified does not contain any files matching the filter condition.Request URL:
/api/v2/readfilemetadataRequest Body:
{ "items": [ { "p": "/System/Core/GenItem.Attachments" }, { "p": "/System/Core/GenItem2.Attachments" } ], "filter": { "extension": "txt" } }Response Body:
{ "data": { "items": [ { "i": 281475020423215, "metadata": { "_dbref": "cbb2d50bd9c870e0f098b9230d66d2f74d55544f2e57f1aabe3830443a040eb6", "custom": { "path": "C:\\Users\\Admin\\Documents\\test-file-2.txt" }, "dateuploaded": 1760007340759, "extension": "txt", "name": "test-file-2.txt", "size": 17 }, "p": "/System/Core/GenItem.Attachments" }, { "error": { "msg": "The filter didn't match any entry." }, "p": "/System/Core/GenItem2.Attachments" } ] } }
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.