CPlugin

MT4 v2 :: Common

API v2 (beta) · MT4 · 3 operations · base URL https://cloud.mywebapi.com · OpenAPI v2 (JSON) · Redoc

Every call needs Authorization: Bearer $TOKEN — an OAuth 2.0 client-credentials token from https://auth.cplugin.net/connect/token (scope webapi). $TRADE_PLATFORM_ID is the id of a trade platform registered in Toolbox.

Operations

Get server time

GET /api/v2/MT4/{tradePlatform}/ServerTime

Server time of the connected MT4 trade server.

Smoke-test endpoint exercising the v2 envelope. Returns current MT4 server time wrapped in ApiResponse<DateTime>.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/ServerTime" \
  -H "Authorization: Bearer $TOKEN"

Get manager common settings

GET /api/v2/MT4/{tradePlatform}/ManagerCommon

Server-wide MT4 trade server settings (curated subset).

Returns MT4Common DTO — server name, broker, server version/build, time zone. Schema is decoupled from the wrapper's ConCommon: v2 clients are protected from MetaQuotes schema changes.

Timeout: 10 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 10 s (read). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/ManagerCommon" \
  -H "Authorization: Bearer $TOKEN"

Get server journal

GET /api/v2/MT4/{tradePlatform}/JournalRequest

Server journal (log) entries for a date window.

Manager (live) call — round-trips to MT4 server. Returns log entries in [from, to] range filtered by mode and an optional free-text filter. Defaults: mode = Full, to = now (server time).

Heavier endpoint — large date windows return large arrays. Pair with reasonable from/to bounds; consider Idempotency-Key for retry safety on slow links.

Timeout: 30 s by default, adjustable per request with the X-Request-Timeout header. When the trade server does not answer in time: Nothing was changed; the request is safe to repeat.

Parameters

NameInTypeRequiredDescription
tradePlatform path string (uuid) yes Trade platform id (GUID)
from query string (date-time) no Window start (UTC, ISO 8601 — required)
to query string (date-time) no Window end (UTC, ISO 8601). Defaults to current server time.
mode query EnLogType no Log category filter. Defaults to Full.
filter query string no Optional substring filter applied server-side.
X-Request-Timeout header number (double) no How long to wait for the trade server, in seconds (1–300). Default for this operation: 30 s (history or report). The query parameter requestTimeout does the same for clients that cannot set headers. The applied value is returned in the X-Request-Timeout-Applied response header.

Responses

Example

curl "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/JournalRequest" \
  -H "Authorization: Bearer $TOKEN"

Schemas

Types the operations above take and return, with their first-level properties; * marks a required one. The full graph is in the OpenAPI specification.

DateTimeApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data string (date-time)
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.

MT4CommonApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT4Common v2 DTO for MT4 server-wide common settings. Curated subset of the wrapper's ConCommon struct — exposes fields useful to clients while shielding the v2 contract from MetaQuotes schema drift.
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.

MT4ServerLogListApiResponse

Unified v2 response envelope: data is the payload (null on error); error is the error object (null on success, always serialised); meta contains response metadata (activityId and optional paging). HTTP status is always 200.

PropertyTypeDescription
data MT4ServerLog[]
error ApiError v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.

EnLogType

Values: Standard, Logins, Trades, Errors, Full, Updater, SendMail, Failover

ApiError

v2 error body. Code is the stable transport error code; ManagerCode is the raw MT4 ResultCode (serialized as a string for a known enum member, or as a number for an unrecognised value returned by MT4); Message is a human-readable description.

PropertyTypeDescription
code WebApiErrorCode Stable transport-level error code.
managerCode ResultCode Raw MT4/MT5 manager result code, when the error came from the trading platform; otherwise null.
message string, nullable Human-readable error description.

ApiMeta

Response metadata. ActivityId is the W3C trace-id for correlation in Seq/SigNoz. Paging is present only on paginated list responses; otherwise it is omitted — the global JSON context policy serialises null fields, so we override that here with System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull.

PropertyTypeDescription
activityId string, nullable W3C trace id for correlating this response in logs and tracing (Seq/SigNoz).
paging PagingMeta Pagination info; present only on list responses, omitted otherwise.

MT4Common

v2 DTO for MT4 server-wide common settings. Curated subset of the wrapper's ConCommon struct — exposes fields useful to clients while shielding the v2 contract from MetaQuotes schema drift.

PropertyTypeDescription
name string, nullable Trade server name
owner string, nullable Broker / company display name
build integer (int32) Trade server build number
version integer (int32) Trade server version
timeZone integer (int32) Server time zone offset from UTC, in hours (DST-adjusted)

MT4ServerLog

v2 DTO for one MT4 server journal entry. Returned by JournalRequest when querying server-side logs for a date window. Same field set as the wrapper's ServerLog — the wrapper struct is already minimal, no secrets to drop. Code serialises as a string via CPlugin.SaaSWebApps.WebAPI.Code.Json.V2JsonContext's UseStringEnumConverter.

PropertyTypeDescription
code string, nullable Log level / message category (Ok / Trade / Login / Warn / Err / Att). Exposed as a plain string instead of an enum because STJ source-gen's global UseStringEnumConverter doesn't consistently apply to leaf-enum fields reachable only via nested generics (List<MT4ServerLog>.Code). Property-level [JsonConverter(typeof(JsonStringEnumConverter<T>))] also failed for the same reason — the source generator does not bind the attribute at the leaf. Mapping at the mapper level (enum.ToString()) is the most reliable path that survives the source generator.
time string, nullable Server-side timestamp as the wrapper formats it (string, not DateTime — preserved verbatim)
ip string, nullable Client IP recorded for the event (empty for server-internal events)
message string, nullable Free-text log message