Read Files

  • Is able to fetch file data stored in different file stores.

  • Accepts a filter for server side filtering.

  • Supports MongoDB options limit, skip and sort

  • Required security permission - READ.

  • HTTP methods supported: GET, POST.

Description

This endpoint allows to read information of files stored in custom file data stores.

Parameters

Name Type Optional Description

filestore

undefined

yes

Specifies the path or the object ID the file store to be queried.

_id

string

yes

MongoDB ObjectId of the file to retrieve.

start_time

string

yes

The start time (UTC) of the interval to retrieve files for. By default not set.

end_time

string

yes

The end time (UTC) of the interval to retrieve files for. By default not set.

filter

object

yes

Additional filter expression. The query syntax is identical to the MongoDB read operation query syntax. By default not set.

limit

integer

yes

The maximum number of file information objects per file store to return. If not supplied a default store limit can be applied.

skip

integer

yes

The number of file information objects per file store to skip from the result. By default not set.

sort

object

yes

Expression to order the files in the response. The syntax is identical to the MongoDB sort expression syntax. Has to be a JSON (dictionary). In case of a HTTP GET the value of this URL query parameter must be Base64 encoded. By default not set.

insights

boolean

yes

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

Including File Store Information

By default the response of this endpoint contains per item a files field, which contains a flat list of file information objects.

Filtering

The filter parameters _id, start_time, end_time and filter are used to create an AND query to filter the files stored in the context of the provided items. In case the _id parameter is set all other filter parameters are ignored. The start_time and end_time are used to filter files based on the timestamp field in the metadata. Only files are returned of which the value of the field metadata.timestamp is greater than or equal to the start_time and less than the end_time parameter.

The syntax of the filter parameter must be conform the MongoDB read operation query syntax.

Sorting

The file information objects in the files list in the response can be sorted by setting the 'sort' option in the request.

The syntax of the sort parameter must be conform the syntax of a MongoDB sort document syntax

Examples

HTTP GET

Request URL

  • `/api/v2/readfile?filestore=%2FSystem%2FCore%2FCFDS&_id=5cf0e75c84b00a016000074c

HTTP POST

Request URL

  • /api/v2/readfile?filestore=%2FSystem%2FCore%2FCFDS

Request body

{
  "filestore": "System/Core/CFDS",
  "start_time": "2023-03-28T00:00:00.000Z",
  "end_time": "2023-03-29T00:00:00.000Z",
  "filter": {
    "metadata.custom.batchid": 1234
  },
  "sort": {
    "uploadDate": -1
  },
  "limit": 100
}
Response body
{
  "data": {
    "file_data": {
      "query_data": [
        {
          "query_index": "1",
          "files": [
            {
              "_id": "5cf0e75c84b00a016000074c",
              "chunkSize": 261120,
              "filename": "DC4711.csv",
              "length": 2727,
              "metadata": {
                "custom": {
                  "batchID": "1234"
                },
                "datemodified": "2023-01-01T15:00:00.000Z",
                "dateuploaded": "2023-03-20T15:50:16.000Z",
                "path": ",DC4711.csv",
                "sinkoid": 281475460562944,
                "sourceoid": 281475460825088
              },
              "uploadDate": "2023-03-20T15:50:15.000Z"
            }
          ]
        }
      ]
    }
  }
}