mattermost/api
Jesse Hallam 70a50edcf2
[MM-67021] Fix 500 errors on check-cws-connection in non-Cloud environments (#34786)
* Fix 500 errors on check-cws-connection in non-Cloud environments

The check-cws-connection endpoint was returning 500 errors in
self-hosted enterprise environments because:

1. The client only checked BuildEnterpriseReady before making the
   request, which is true for all enterprise builds
2. The server handler didn't check for a Cloud license before
   attempting to connect to CWS
3. The CWS URL is not configured in non-Cloud environments, causing
   the connection check to fail

This fix:
- Server: Add IsCloud() license check to match other cloud endpoints,
  returning 403 instead of 500 for non-Cloud licenses
- Client: Add Cloud license check to skip the request entirely in
  non-Cloud environments

* Add unit tests for check-cws-connection license check

* Return JSON status from check-cws-connection endpoint

Change the check-cws-connection endpoint to return 200 with a JSON body
containing status (available/unavailable) instead of using HTTP error
codes. This allows the endpoint to be used for air-gap detection on
self-hosted instances, not just Cloud deployments.

* i18n

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
2026-02-02 13:41:14 +00:00
..
playbooks Move API Reference (#23777) 2023-06-27 11:10:13 -03:00
server Updated API Code Samples (#24141) 2023-08-03 12:45:10 -03:00
v4 [MM-67021] Fix 500 errors on check-cws-connection in non-Cloud environments (#34786) 2026-02-02 13:41:14 +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 [MM-66359] Recaps MVP (#34337) 2026-01-13 11:59:22 -05:00
package-lock.json chore(deps): pin whatwg-url to 12.0.0+ in /api (#27463) 2024-06-27 20:41:58 -03: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.