Skip to content

[TASK] Support mimeTypes filtering in /api/v1/drive/search #34205

@nicobytes

Description

@nicobytes

Description

As a frontend developer implementing the File Picker component, I want to filter results by specific MIME types (e.g., images, PDFs) when using the /api/v1/drive/search endpoint, So that the file picker displays only the relevant assets to the user, replacing the functionality currently provided by the legacy /api/v1/browser endpoint.

Context & Problem Statement

We are currently migrating the "Select Existing File" picker component to use the new, more efficient /api/v1/drive/search endpoint (Elasticsearch-backed) instead of the legacy /api/v1/browser endpoint (DB-backed).

Currently, the legacy /api/v1/browser supports a mimeTypes array parameter:

JSON

{
    "hostFolderId": "SYSTEM_HOST",
    "mimeTypes": ["image/jpeg", "image/png"], // Existing functionality
    "showLinks": false,
    ...
}

However, the new /api/v1/drive/search endpoint does not yet support filtering by MIME type. It currently looks like this:

{
    "assetPath": "//demo.dotcms.com/activities/",
    "filters": {
        "text": "",
        "filterFolders": true
    },
    ...
}

Without this filter, the picker displays all file types, which degrades the user experience when specific asset types (like images only) are required.

Acceptance Criteria

Parameter Support: The /api/v1/drive/search endpoint accepts a list of MIME types in the request payload.

Priority

None

Additional Context

No response

Metadata

Metadata

Type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions