Skip to main content
Use this approach when you want full control over networking (your own STOMP client, your own REST layer, your own auth/token storage).

WebSocket API (STOMP)

MastermindCMS exposes a STOMP broker over WebSocket:
  • Native WebSocket endpoint: /ws
  • SockJS fallback endpoint: /sock
  • Application destination prefix: /request
  • Broker destinations: /topic/**, /user/topic/**, and /queue/**

Subscribe

Default JSON responses:
  • /topic/msm/json
  • /user/topic/msm/json
Default HTML (SSR) render responses:
  • /topic/msm/render
  • /user/topic/msm/render
The backend can also publish domain events to custom destinations under /topic/** (for example /topic/jobs, /topic/job/{id}, /topic/order/{id}, /topic/customer/{id}).

Publish destinations

Render (SSR): JSON:

Request and response shape

All WebSocket requests are based on BasicRequestMessage:
  • path: current page path (request context)
  • payload: optional data (depends on the destination)
  • elements: optional list of element payloads for partial updates
  • actionId: optional correlation id (recommended)
  • eventType: USER, SHARED, or GLOBAL
  • sharedEndpoint: optional logical endpoint name (the backend responds to /topic/<sharedEndpoint>)
Specialized request messages add fields:
  • BeanRequestMessage: scope, beanId, functionName, args
  • RepositoryRequestMessage: repositoryId, requestType
  • DocumentRequestMessage: databaseName, collectionName, requestType
JSON responses use:

Example (browser)

Authorization notes

  • JSON handlers can accept a JWT via the native header Authorization: Bearer <token>.
  • Some operations require elevated permissions (for example repository updates and database writes). If access is denied, the backend responds with { "error": "Access denied", ... }.

REST API

REST is used for:
  • authentication (/api/v1/authenticate, /api/v1/logout, token operations)
  • file and data operations (upload/remove/download)
  • report export and asset listing
  • integrations (for example, delivery/payment providers)
  • HTTP fallback for service calls (/api/v1/bean/request)

Common headers

Some endpoints (notably /api/v1/bean/request) require request context headers:

Authentication

POST /api/v1/authenticate authenticates a user (typically via session/remember-me cookies). To obtain a JWT token for API calls, use POST /api/v1/auth/token (returns { token, expires }). You can validate a token with POST /api/v1/auth/validate-token. POST /api/v1/logout logs out the current session and expects a JSON body that includes role (for example "user" or "admin").

Unified service call over HTTP

POST /api/v1/bean/request calls a backend bean method using the same reflection-based mechanism as the WebSocket API. Required headers:
  • Site-Context
  • Lang-Context
Request example:
Response example:

Uploads, downloads, assets, reports

Example: upload an image
Example: export a report

Delivery and payment integrations

Some integrations are exposed as REST endpoints and used by corresponding UI components. Examples include:
  • /api/v1/cdek (delivery widget service/proxy)
  • /api/v1/stripe (Stripe payment webhook)
  • /api/v1/yookassa (payment integration)

Password reset and verification

If email/password flows are enabled, MastermindCMS can expose endpoints such as:
  • /api/v1/auth/verify
  • /api/v1/auth/reset-password
  • /api/v1/auth/change-password
  • /api/v1/auth/save-password