FileBrowser Quantum Module API Explanation
The FileBrowser Quantum module retrieves file inventory counts and precise storage pool metrics from the FileBrowser API.
API Execution Logic
The module locates the service entry matching the identifier filebrowser. It extracts the API token from FILEBROWSER_TOKEN (or FILEBROWSER_API_KEY) and attaches it via the Authorization: Bearer [TOKEN] header.
Multi-Step Request Execution
To support multi-source Quantum installations without triggering HTTP 500 errors (which occur if storage source parameters are omitted), the module performs a multi-step query sequence:
- Source Discovery: The module queries
/api/settings?property=sources. The response is parsed to discover and cache the name of the primary storage pool. - Storage Stats Retrieval: A request is sent to
/api/settings/sources. The JSON payload is parsed using the discovered source name as the lookup key to retrieve the exactusedandtotalbyte capacity values. - Folder and File Count: A request is sent to
/api/resources?path=/&source=[SOURCE]. The module counts the elements in the returned resources list, utilizing the customnumFilesattribute or filtering out elements matching thedirectorytype.
Metric Calculation and Formatting
- Primary Metric: The total count of files.
- Secondary Metric: The formatted used storage capacity versus total capacity (e.g.,
27.9 GB / 1.8 TB), calculated using a byte conversion formatter.
Caching Strategy
To avoid re-executing source discovery and polling multiple endpoints, the responses are cached for 60 seconds (TTL) with a maximum stale limit of 300 seconds.