Writing Data (POST Method)
To store data on the server, you must send an HTTP POST request with URL-encoded form data. The MIO Server accepts parameters like folder name, file name, and message content.
Required Parameters
| Parameter | Description |
|---|---|
key | Password defined in config.ini (password=...) |
token | Folder name where the file will be stored |
file | Filename to save the data into (within the token folder) |
message | Content of the message (plain text or CSV data, etc.) |
Optional Parameters
| Parameter | Description | Default |
|---|---|---|
mode | overwrite or append (controls file write behavior) | overwrite |
Example cURL Command
curl -d "key=public&token=device01&file=data.txt&message=Hello+world" http://localhost:9123
To append a new line to an existing file:
curl -d "key=public&token=device01&file=data.txt&message=Another+line&mode=append" http://localhost:9123
Error Responses
| HTTP Code | Meaning |
|---|---|
403 | Invalid or missing key |
413 | Message too large |
400 | Malformed request |
500 | File write error on disk |
File Structure
Files are stored in:
[serverpath]/[token]/[file]
For example:
./db/device01/data.txt
Each token becomes a folder. Files inside will be either created new or appended depending on mode.
📝 Notes
- Message size must not exceed
maxmessagedefined inconfig.ini - If the folder or file does not exist, it will be created
messageshould be URL-encoded (e.g., spaces =+)mode=appendautomatically adds a\nnewline after each message (if not present)