Retrieving Data (GET Method)
To read a previously stored file, use a standard HTTP GET
request. The server responds with the file contents based on the token
(folder) and file
(filename) parameters provided in the query string.
Required Parameters
Parameter | Description |
---|---|
token | Folder name (used during the POST request) |
file | Filename inside the folder |
Example URL
curl "http://localhost:9123/?token=device01&file=data.txt"
This will return the full contents of the file located at:
./db/device01/data.txt
Response Headers
The server sends:
Content-Type
: value fromcontenttype
inconfig.ini
charset
: value fromcharcode
inconfig.ini
Content-Length
: actual file size in bytes
Example HTTP response header:
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf8
Content-Length: 128
Error Responses
HTTP Code | Meaning |
---|---|
404 | File not found or missing parameters |
405 | Method not supported (only GET & POST) |
💡 Notes
- This method is useful for reading logs, status updates, or stored CSV files.
- You can open the link in a browser or fetch it from code.
- Files are served as-is. You can serve any file type (CSV, TXT, JSON).