Skip to content
SciLor edited this page Jun 27, 2020 · 11 revisions

This entry contains the api documentation.

Endpoint /api/ajax

GET Parameter "cmd" as command name

get-config - Sends the current config as JSON

Result

{"version":2,"battery":{"voltageFactor":67690,"voltageChargerFactor":71907,"minimalAdc":2400,"sleepMinutes":15},"buttonEars":{"longPressMs":1000,"veryLongPressMs":10000},"wifi":{"ssid":"","password":""}}

get-dir Directory file listing

Parameters

dir

Contains the target directory path

Result

{"files":[{"name":"CONTENT","size":0,"time":11942,"date":20662,"dir":true},{"name":"revvox","size":0,"time":39661,"date":20661,"dir":true},{"name":"initsd.crc","size":5123,"time":0,"date":33,"dir":false},{"name":"hackiebox.config.json","size":228,"time":23491,"date":20665,"dir":false}]}

get-file - Sends the specified file

Parameters

filepath

Contains the target file path

start (optional)

Ignore bytes until [start]

length (optional)

Read max [length] bytes

Result

Raw filestream

get-flash file - Sends the specified file from flash

Parameters

filepath

Contains the target file path

start (optional)

Ignore bytes until [start]

length (optional)

Read max [length] bytes

Result

Raw filestream

copy-file - Copy file to a different location (TBD)

Parameters

source

Full [source] file path

target

Full [target] file path

Result

404 or { "success": true }

move-file - Move file to a different location

Parameters

source

Full [source] file path

target

Full [target] file path

Result

404 or { "success": true }

delete-file - Move file to a different location

Parameters

filepath

Full [filepath]

Result

404 or { "success": true }

create-dir - Create dir

Parameters

dir

Full [dir] file path

Result

404 or { "success": true }

copy-dir - Copy dir to a different location (TBD)

Parameters

source

Full [source] file path

target

Full [target] file path

Result

404 or { "success": true }

move-dir - Move dir to a different location

Parameters

source

Full [source] dir path

target

Full [target] dir path

Result

404 or { "success": true }

delete-dir - Delete directory

Removes an empty directory

Parameters

dir

Full [dir]

Result

404 or { "success": true }

box-power power related commands

Parameters

sub

Subcommand

Subcommands

reset

Restarts the device

hibernate

Goes into hibernation

Result

404 or { "success": true }

cli - Command line interface

Parameters

cli

Command, type "help" for more details.

Result

Raw command line result. Example for help

# help
Help:

i2c [-read] [-write] -a/ddress <value> -r/egister <value> [-v/alue <value>] [-l/ength <1>] [-o/utput <b>]
 Access I2C

beep [-m/idi-id <60>] [-l/ength <200>]
 Beep with build-in DAC synthesizer

help
 Show this screen

Endpoint /api/upload/*

Standard POST file upload. Attention, only one upload at once supported or you may get corrupt files!

Parameters

filepath

Specifies the target file path.

overwrite

Enable to allow overwriting files

start (optional)

Skip bytes until [start]

/api/upload/file

Upload file to sd card.

/api/upload/flash-file - TBD

Upload file to flash

Clone this wiki locally