Upload a firmware file
const url = 'http://pwrman.local/api/v1/update';const options = { method: 'POST', headers: { 'Content-Length': '1', Authorization: 'Bearer <token>', 'Content-Type': 'application/octet-stream' }, body: 'example'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://pwrman.local/api/v1/update \ --header 'Authorization: Bearer <token>' \ --header 'Content-Length: 1' \ --header 'Content-Type: application/octet-stream' \ --data exampleThe body is controller.signed.bin from a
release. The
controller checks the signature, installs the file and restarts on
trial a second after replying. It refuses unsigned files, files for
other hardware and older versions. Port power stays on throughout.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”The file size. Chunked bodies are refused.
Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”Installed. The controller restarts into it in one second.
object
The flash slot the file was written to.
Example
{ "ok": true, "slot": "B", "bytes": 854580, "version": "0.13.0", "action": "trial reboot in 1s"}The body was sent chunked.
object
Why the request was refused, in words.
Example
{ "error": "chunked bodies unsupported; send Content-Length"}The token is missing or wrong, or no token is set yet.
object
Why the request was refused, in words.
Examples
{ "error": "bearer token required"}{ "error": "no API token set yet: finish first-time setup first"}Another update is running or about to restart, or the file does not fit.
object
Why the request was refused, in words.
Example
{ "error": "another update is already in progress"}The request has no Content-Length.
object
Why the request was refused, in words.
Example
{ "error": "Content-Length required"}The file was refused, for example for its signature, its hardware or its version.
object
Why the request was refused, in words.
Example generated
{ "error": "example"}USB Type-C® and USB-C® are registered trademarks of USB Implementers Forum.