OTA Update REST API

I found the following link via google, but I guess the description is outdated.

https://mongoose-os.com/docs/mdash/ota.md

Thats exactly what i need to make quick ota updates.

I have tried the following:

curl -H 'Authorization: Bearer Token -H 'Content-Type: multipart/form-data' -X POST -v -F file=@fw.zip \
     https://mdash.net/api/v2/devices/d5/ota

With the error response:

{
  "error": {
    "code": 500,
    "message": "form file error: no multipart boundary param in Content-Type"
  }
}

Does this command still work in any form?

I think you can drop the -H ‘Content-Type: multipart/form-data’ and -X POST parts. It should work.

With …

curl -H 'Authorization: Bearer TOKEN' -v -F file=@fw.zip \
     https://mdash.net/api/v2/devices/d5/ota

i get:

HTTP/1.1 405 Method Not Allowed
Server: nginx/1.12.2
Date: Fri, 12 Jul 2019 13:28:33 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 33
Connection: close

{
  "message": "Method Not Allowed"
}

Just verified,

curl -v -F file=@fw.zip https://mdash.net/api/v2/devices/ID/ota?access_token=TOKEN

works fine.

hm, I copied and pasted your line, replaced TOKEN and ID, but the answer remains the same:

HTTP/1.1 405 Method Not Allowed
Server: nginx/1.12.2
Date: Fri, 12 Jul 2019 16:26:07 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 33
Connection: close

{
  "message": "Method Not Allowed"
}

Even if I only use curl https://mdash.net/api/v2/devices/ID/ota … but this query works curl https://mdash.net/api/v2/devices/ID

That’s weird! Maybe the problem is with the OS / curl version?
I am on MacOS 10.14.4

$ curl --version
curl 7.54.0 (x86_64-apple-darwin18.0) libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz HTTP2 UnixSockets HTTPS-proxy 

Hi when I type in the command for an OTA upgrade to my ESP 32 I get {“message”:“Unauthorized”} can any one help here

the command is curl -v -F file=@C:/Users/nadekumar/Documents/ota_mdash/GpioReadWrite_MDash.ino.esp32.bin http://mdash.net/api/v2/devices/device6/ota?access_token=4t0r99WN91rD7ArhDcEkwe3g

I am using a windows 10 laptop to fire the curl command and the esp32 is within the same network as the bin file(in the laptop)

  1. Make sure that access_token=... is the REST API token, not a “device token”
  2. Make sure you do not show it to everyone
1 Like