Skip to content

SD Card

Returns a list of files and subdirectories.

POST /api/card/dir/

Request Parameters:

FieldTypeRequiredDescription
pathstringYesAbsolute path to directory.
fromIdxintegerNoStart index (default 0).
toIdxintegerNoEnd index.

Example Request:

{
"path": "/logs",
"fromIdx": 0
}

Response:

FieldTypeDescription
fromIdxinteger / nullIndex of first returned element.
toIdxinteger / nullIndex of last returned element.
totalintegerTotal items in directory.
itemsarrayArray of file/directory objects.

Each item in items contains:

FieldTypeDescription
namestringFile or directory name.
attribstringAttributes: d (dir), r (read), w (write).
sizeintegerFile size in bytes.
datetimestringLast modification time (ISO 8601).

Example Response:

{
"fromIdx": 0,
"toIdx": 0,
"total": 1,
"items": [
{
"name": "ATM.LOG",
"attrib": "-rw",
"size": 5768906,
"datetime": "2025-04-16T16:07:38"
}
]
}

Returns metadata about a file.

POST /api/card/file/info/

Request Parameters:

ParameterTypeDescription
pathstringAbsolute path to file.

Example Request:

{
"path": "/sgs.bin"
}

Response:

FieldTypeDescription
namestringFile name.
attribstringFile attributes in POSIX format (drw).
sizeintegerFile size in bytes.
datetimestringLast modification date (ISO 8601 format).

Example Response:

{
"name": "SGS.BIN",
"attrib": "-rw",
"size": 860,
"datetime": "2025-04-16T15:12:52"
}

Returns file data block in base64 encoding.

POST /api/card/file/read/

Request Parameters:

FieldTypeDescription
pathstringAbsolute path to file.
blockIdxintegerBlock number (starting from 0).

Example Request:

{
"path": "/sgs.bin",
"blockIdx": 0
}

Response:

FieldTypeDescription
blockIdxintegerCurrent block number.
blockCountintegerTotal number of blocks in the file.
datastringBase64 encoded data of the current block (1024 bytes).

Example Response:

{
"blockIdx": 0,
"blockCount": 2,
"data": "63sM/2R3ki8uAC4AAQBMA9AHCAQBAAEBAAEAAAEBAW8FAQELAw8DPFAAWAJuZf//9gGXiHgAyADoAxQABQAAAFoAAACAJQAAgIwo2MCoAHP///8AwKgAAQgICAgICAQE2IA5aQ5tZ2FwAAAAAAAAAAAAZ2FwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAH/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4TADs5AAACbnRwLnRpbWUuaW4udWEAAAAAAAAAAG50cDIuc3RyYXR1bTEucnUAAAAAAAABGAEMAwoHAgoKBwIAABMAKjExMSMAAAAAAAAAAAAAAMCoAHD2AegDFAAAAAAAAf8AAAAAAAAAAAAAAADAqABx9gHoAxQAAAAAAAH/AAAAAAAAAAAAAAAAwKgAcvYB6AMUAAAAAAAB/wAAAAAAAAAAAAAAAMCoAHP2AegDFAAAAAAAAf8AAAAAAAAAAAAAAADAqAB09gE="
}

Uploads file data to SD card.

POST /api/card/file/write/

Request Parameters:

FieldTypeDescription
pathstringAbsolute path to file (e.g., /file.bin).
blockIdxintegerBlock number to write (starting from 0).
blockCountintegerTotal number of blocks to write.
datastringBase64 encoded data to write (1024 bytes per block).

Note: Data in blocks must be strictly 1024 bytes, except for the last block.

Example Request:

{
"path": "/file.bin",
"blockIdx": 0,
"blockCount": 2,
"data": "63sM/2R3ki8uAC4AAQBMA9AHCAQBAAEBAAEAAAEBAW8FAQELAw8DPFAAWAJuZf//9gGXiHgAyADoAxQABQAAAFoAAACAJQAAgIwo2MCoAHP///8AwKgAAQgICAgICAQE2IA5aQ5tZ2FwAAAAAAAAAAAAZ2FwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKAAH/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB4TADs5AAACbnRwLnRpbWUuaW4udWEAAAAAAAAAAG50cDIuc3RyYXR1bTEucnUAAAAAAAABGAEMAwoHAgoKBwIAABMAKjExMSMAAAAAAAAAAAAAAMCoAHD2AegDFAAAAAAAAf8AAAAAAAAAAAAAAADAqABx9gHoAxQAAAAAAAH/AAAAAAAAAAAAAAAAwKgAcvYB6AMUAAAAAAAB/wAAAAAAAAAAAAAAAMCoAHP2AegDFAAAAAAAAf8AAAAAAAAAAAAAAADAqAB09gE="
}

Response:

Empty JSON on success.

{}

Removes a file from the SD card.

POST /api/card/remove/

Request Parameters:

FieldTypeDescription
pathstringAbsolute path to file.

Example Request:

{
"path": "/1.pdf"
}

Response:

Empty JSON on success.

{}

Prepares SD card for safe removal.

POST /api/cmd/memory/card_eject/

Example Request:

{}

Response:

Empty JSON on success.

{}