OTA updates
You can push new firmware images to your devices and let them download the current version through the OTA endpoints.
upload a new firmware image for a device
$ curl 'https://www.offbeat-iot.com/api/devices/device-1234/images' -i -u 'username:password' -X POST \
-H 'Content-Type: multipart/form-data' \
-F 'File=firmware-body'
and you will see
HTTP/1.1 200 OK
download the current firmware image
$ curl 'https://www.offbeat-iot.com/api/devices/device-1234/images' -i -u 'username:password' -X GET \
-H 'X-Esp8266-Version: firmware.bin'
and you will see
HTTP/1.1 200 OK
Content-Disposition: attachment; filename="=?UTF-8?Q?firmware.bin?="; filename*=UTF-8''firmware.bin
Content-Type: application/octet-stream
Content-Length: 13
Cache-Control: no-cache
Pragma: no-cache
Expires: 0
X-Accel-Buffering: no
Accept-Ranges: bytes
firmware-body
The upload endpoint notifies the device over the WebSocket with the upcoming version information. A typical message looks like:
{ "nextVersion": "firmware.bin" }
Use this to trigger your device-side OTA download logic after the server confirms the upload.