CPlugin

MT4 v2 :: News

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

Every call needs Authorization: Bearer $TOKEN — an OAuth 2.0 client-credentials token (scope webapi). The token server belongs to the environment: for the Sandbox call https://pre.mywebapi.com and take the token from https://pre.auth.cplugin.net/connect/token; for Production take it from https://auth.cplugin.net/connect/token. Clients and tokens of the two are separate — a token from one answers 401 on the other. $TRADE_PLATFORM_ID is the id of a trade platform registered in Toolbox. A failed operation is also answered with HTTP 200: check error before using data. Access and transport failures use HTTP codes — see Errors.

Operations

Get news count

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

Total number of news items currently held in the cached copy.

Cached read — instant local lookup, no round-trip to MT4 server. Useful as a cheap polling probe before fetching news bodies.

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/NewsTotal" \
  -H "Authorization: Bearer $TOKEN"

Get news body (cached)

GET /api/v2/MT4/{tradePlatform}/NewsBodyGet/{key}

Body text of a cached news item by its key.

Cached read — pair with NewsTotal and NewsGet (later) to enumerate cached news. The key is the news item id known to MT4.

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)
key path integer (int32) yes News item id
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/NewsBodyGet/$KEY" \
  -H "Authorization: Bearer $TOKEN"

List news headers

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

All cached news topic headers (no body — fetch separately).

Cached read — returns the full news topic table held by the live connection. Each entry is a header (Key, Time, Topic, Category, Keywords, Priority, LangId). Body text is fetched via NewsBodyGet(key) after asking the live connection to populate it via NewsBodyRequest(key).

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/NewsGet" \
  -H "Authorization: Bearer $TOKEN"

Get news header by index

GET /api/v2/MT4/{tradePlatform}/NewsTopicGet/{pos}

Single cached news topic header by zero-based index.

Cached read — useful for paginating news without re-marshalling the whole array. Pair with NewsTotal to bound the index. Returns a platform-failure envelope when pos is out of range.

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)
pos path integer (int32) yes Zero-based index into the cached news array
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/NewsTopicGet/$POS" \
  -H "Authorization: Bearer $TOKEN"

Request news body fetch

POST /api/v2/MT4/{tradePlatform}/NewsBodyRequest/{key}

Ask the live connection to fetch the body for the given news key (fire-and-forget).

POST because this is a side effect on the live connection (it queues a fetch). The platform method returns void — there is no synchronous success/failure to surface. A subsequent NewsBodyGet(key) will see the body once the live connection has retrieved it. The payload is a sentinel true meaning "request dispatched".

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)
key path integer (int32) yes News item key (from NewsGet/NewsTopicGet)
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 -X POST "https://cloud.mywebapi.com/api/v2/MT4/$TRADE_PLATFORM_ID/NewsBodyRequest/$KEY" \
  -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.

Int32ApiResponse

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). A call that reaches an operation answers HTTP 200 — only transport failures (401, 403, 404, 400, 5xx) use other status codes.

PropertyTypeDescription
data integer (int32)
error ApiError v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

StringApiResponse

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). A call that reaches an operation answers HTTP 200 — only transport failures (401, 403, 404, 400, 5xx) use other status codes.

PropertyTypeDescription
data string, nullable
error ApiError v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT4NewsTopicListApiResponse

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). A call that reaches an operation answers HTTP 200 — only transport failures (401, 403, 404, 400, 5xx) use other status codes.

PropertyTypeDescription
data MT4NewsTopic[]
error ApiError v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

MT4NewsTopicApiResponse

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). A call that reaches an operation answers HTTP 200 — only transport failures (401, 403, 404, 400, 5xx) use other status codes.

PropertyTypeDescription
data MT4NewsTopic v2 record describing a single news topic header as held in the platform's cached copy. Curated subset of the platform's NewsTopic: enough to render a list / browse view of broker-distributed news (Key for follow-up NewsBodyGet / NewsBodyRequest, Time, Topic, Category, Keywords, Priority, LangId). The news body is not part of the topic; fetch it with NewsBodyGet(key).
error ApiError v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

BooleanApiResponse

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). A call that reaches an operation answers HTTP 200 — only transport failures (401, 403, 404, 400, 5xx) use other status codes.

PropertyTypeDescription
data boolean
error ApiError v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.
meta ApiMeta Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

ApiError

v2 error body, present when a call failed even though it answered HTTP 200. Code is the stable error category. ManagerCode is the raw result code of the trade server on MT4 (null otherwise: on MT5 the result name is in Message). Message is a human-readable description.

PropertyTypeDescription
code WebApiErrorCode Stable transport-level error code.
managerCode ResultCode Raw MT4 result code when ApiError.Code is MT4Error; null otherwise. On MT5 the result name is in ApiError.Message.
message string, nullable Human-readable error description.

ApiMeta

Response metadata. ActivityId identifies the request — quote it when you contact support. Paging is present only on paginated list responses; otherwise it is omitted.

PropertyTypeDescription
activityId string, nullable W3C trace id of the request. Quote it when you contact support: it finds this exact call in the server logs.
paging PagingMeta Pagination info; present only on list responses, omitted otherwise.

MT4NewsTopic

v2 record describing a single news topic header as held in the platform's cached copy. Curated subset of the platform's NewsTopic: enough to render a list / browse view of broker-distributed news (Key for follow-up NewsBodyGet / NewsBodyRequest, Time, Topic, Category, Keywords, Priority, LangId). The news body is not part of the topic; fetch it with NewsBodyGet(key).

PropertyTypeDescription
key integer (int32) News key — the identifier used by NewsBodyGet and NewsBodyRequest to fetch the body for this topic.
time string (date-time) Published time of the news topic (UTC).
topic string, nullable News headline / subject (max 256 chars at the platform layer).
category string, nullable News category. Slash-separated path on the platform side (e.g. "Markets\Asian Markets News") used by the MT4 client terminal to build a tree view. Max 64 chars at the platform layer.
keywords string, nullable Comma-separated keyword list (max 256 chars). Used by quote-feed brokers as a symbol filter — for example "!EURUSD, EUR*" selects all EUR pairs except EURUSD.
priority integer (int32) News priority: 0 = general, 1 = high.
langId integer (int32) Windows LCID language id. 0 means unspecified; otherwise the low 16 bits of a Windows LCID (the language portion).