mattermost/api
Alejandro García Montoro c6b59cc9a7
MM-68663: Admin console support and Test Connection generalization for Azure Blob Storage (#36583)
* Generalize the file storage Test Connection endpoint

Replaces the S3-only /api/v4/file/s3_test handler with a backend-agnostic
POST /api/v4/file/test that validates mandatory fields per driver and
runs a write/read/delete probe against the configured backend. The
legacy /file/s3_test route stays as a thin wrapper so existing clients
keep working.

The driver switch validates S3 and Azure mandatory fields explicitly,
treats Local as a no-op (no required credentials), and rejects unknown
or empty driver names with a 400 and a specific error code so admins
get a useful message instead of a generic backend failure.

Reuses config.Desanitize (renamed from the package-private desanitize)
so the FakeSetting placeholder swap for secrets is shared with the
PUT /api/v4/config save path. Adding a new driver-secret in the future
only requires touching config.Desanitize once. Desanitize is also made
nil-safe on every pointer dereference so callers can hand it a partial
config without first running SetDefaults().

Mattermost-redux and the webapp client gain a corresponding
TestFileStoreConnection method that the admin console action layer
calls instead of the deprecated S3-specific method.

------
AI assisted commit

* Wire Azure Blob Storage into the file storage admin console

Adds the Azure Blob Storage option to the File Storage panel in the
System Console. Selecting it enables Azure-specific fields for the
storage account name, container, optional path prefix, shared key,
optional endpoint override, secure-connections toggle, and request
timeout. The fields are hidden and disabled when the driver is set to
Local or S3, matching the existing pattern.

Help text and placeholders are added in the webapp i18n catalog so
admins see the same field labels documented in the admin guide.

The same set of fields is repeated for the Files Export panel when
DedicatedExportStore is enabled, keeping the export backend
configurable independently of the primary file store.

------
AI assisted commit

* Document /api/v4/file/test in the OpenAPI spec

Adds the new backend-agnostic file storage Test Connection endpoint to
the public OpenAPI surface. The request body is optional: callers that
omit it test the running server configuration, callers that include a
full AdminConfig test the supplied configuration without persisting
anything. The deprecated /api/v4/file/s3_test endpoint is left
unchanged in the spec for the existing S3-only flow.

------
AI assisted commit

* Add UI-only Cypress coverage for the Azure file storage panel

Adds a Cypress spec that drives the System Console File Storage panel,
switches the driver to Azure Blob Storage, fills in the Azure fields,
and asserts the expected fields appear (and S3 fields are hidden). The
spec is UI-only and does not depend on an Azure backend or Azurite, so
it can run in CI without external infrastructure.

Updates the existing environment_spec.js so it tolerates the new Azure
option in the driver dropdown.

------
AI assisted commit

* Nil-guard file storage mandatory-field checks

CheckMandatoryS3Fields and CheckMandatoryAzureFields built a
FileBackendSettings via NewFileBackendSettingsFromConfig before
validating, but that constructor dereferences pointers
unconditionally and would panic if a caller skipped the api
handler's reflective nil check. Validate the required pointers
directly against FileSettings instead, dropping the throwaway
constructor call so the methods are safe to call from any path.

------
AI assisted commit

* Check permission before validating file settings

The /file/test handler ran checkHasNilFields before
SessionHasPermissionTo, so an unauthorized caller posting a partial
config got a 400, leaking config shape, rather than a 403. Swap the two
blocks so the permission decision happens first.

------
AI assisted commit

* Preserve FakeSetting when desanitize has no actual

The Azure access key, export Azure access key, and S3 secret access key
branches in Desanitize reassigned target to actual without checking
actual for nil. When the running config had no value, the FakeSetting
placeholder in target was replaced with nil, dropping the field from the
round-trip. Guard the assignment so the placeholder stays in place when
actual is unset.

------
AI assisted commit

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-05-25 11:36:02 +00:00
..
playbooks Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
server Upgrade Go to 1.26.3 and update deps in tool modules (#36658) 2026-05-20 17:25:49 -04:00
v4 MM-68663: Admin console support and Test Connection generalization for Azure Blob Storage (#36583) 2026-05-25 11:36:02 +00:00
.gitignore Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
.spectral.yaml Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
CONTRIBUTING.md Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
Makefile Add board channel types (BO/BP) for Integrated Boards (#35887) 2026-05-13 16:25:08 -07:00
package-lock.json Ability to E2E AI Bridge features + Initial Recaps E2E (#35541) 2026-03-30 16:20:47 +00:00
package.json feat: Switch from Redoc to Stoplight Elements for API documentation (#30591) 2025-04-17 12:31:56 +03:00
README.md feat: Switch from Redoc to Stoplight Elements for API documentation (#30591) 2025-04-17 12:31:56 +03:00

Mattermost API Documentation

This repository holds the API reference documentation for Mattermost available at https://developers.mattermost.com/api-reference.

The Mattermost API reference uses the OpenAPI standard and the ReDoc document generator.

All documentation is available under the terms of a Creative Commons License.

Contributing

We're accepting pull requests! See something that could be documented better or is missing documentation? Make a PR and we'll gladly accept it.

All the documentation is written in YAML and found in the v4/source directories. APIv4 documentation is in the v4 directory. APIs for Playbooks are retrieved from GitHub at build time and integrated into the final YAML file.

There is no strict style guide but please try to follow the example of the existing documentation.

To build the full YAML, run make build and it will be output to v4/html/static/mattermost-openapi-v4.yaml. This will also check syntax using swagger-cli.

To test locally, run make build, make run and navigate to http://127.0.0.1:8080. For any updates to the source files, re-run the same commands.

Deployment

Deployment is handled automatically by our Github Actions. When a pull request is merged, it will automatically be deployed to https://developers.mattermost.com/api-reference.