mServer: the HTTP interface¶
POHODA mServer is an HTTP server built into Pohoda. It accepts a
dataPack in the body of an HTTP POST and returns a responsePack –
the same XML as file import/export (XML format: dataPack).
Operation¶
Pohoda must be running; one mServer configuration occupies one program instance, which cannot be used for manual work at the same time. Start Pohoda a second time for manual work.
Typical use: mKasa, third-party applications, web shops.
Stormware recommends a server OS on an internal network; do not run mServer on a machine with a public IP address. Traffic is plain HTTP by default (older documentation) – put TLS on a reverse proxy if needed.
Source: stormware.cz/pohoda/xml/mserver (overview); the details below follow the implementation of the PHP-Pohoda-Connector client.
Endpoints¶
Path |
Use |
|---|---|
|
POST with a |
|
Availability check (POST with authentication). The response contains
the text |
HTTP headers¶
Header |
Meaning |
|---|---|
|
|
|
Application name (shown in the XML Import agenda). |
|
Selects a specific mServer instance / configuration. |
|
|
|
|
Example with curl:
curl -sS -X POST http://192.168.0.1:444/xml \
-H "STW-Authorization: Basic $(printf 'user:pass' | base64)" \
-H "STW-Application: MyApp" \
-H "Content-Type: application/xml" \
--data-binary @datapack.xml
Note
The ASP/HTTP connector for mServer (official Stormware guide) uses the
header Stw-Server-Name to select a server; do not use it in direct
calls.
Response codes¶
Code |
Typical cause with mServer |
|---|---|
|
Request processed; the per-record state is in the XML response. |
|
Syntactically invalid request (bad XML). |
|
Missing authentication, or the user does not exist in Pohoda. |
|
The user may not open the accounting unit. |
|
Wrong URL – the |
|
A method other than POST was used. |
|
Processing time exceeded. |
|
Unspecified processing error. |
|
Proxy / service unavailable / gateway timeout. |
Notes for clients¶
The response is Windows-1250 – convert to UTF-8.
Set a sensible timeout (PHP-Pohoda-Connector defaults to 30 s); large exports take longer.
Compression is optional (
POHODA_COMPRESS).