Skip to content

Upload a firmware file

POST
/api/v1/update
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 example

The 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.

Content-Length
required
integer
>= 1

The file size. Chunked bodies are refused.

Media typeapplication/octet-stream
string

Installed. The controller restarts into it in one second.

Media typeapplication/json
object
ok
required
boolean
slot
required

The flash slot the file was written to.

string
Allowed values: A B
bytes
required
integer
version
required
string
action
required
string

Example

{
"ok": true,
"slot": "B",
"bytes": 854580,
"version": "0.13.0",
"action": "trial reboot in 1s"
}

The body was sent chunked.

Media typeapplication/json
object
error
required

Why the request was refused, in words.

string

Example

{
"error": "chunked bodies unsupported; send Content-Length"
}

The token is missing or wrong, or no token is set yet.

Media typeapplication/json
object
error
required

Why the request was refused, in words.

string

Examples

{
"error": "bearer token required"
}

Another update is running or about to restart, or the file does not fit.

Media typeapplication/json
object
error
required

Why the request was refused, in words.

string

Example

{
"error": "another update is already in progress"
}

The request has no Content-Length.

Media typeapplication/json
object
error
required

Why the request was refused, in words.

string

Example

{
"error": "Content-Length required"
}

The file was refused, for example for its signature, its hardware or its version.

Media typeapplication/json
object
error
required

Why the request was refused, in words.

string

Example generated

{
"error": "example"
}

USB Type-C® and USB-C® are registered trademarks of USB Implementers Forum.