OTA Update REST API

#1

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?

#2

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

#3

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"
}
#4

Just verified,

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

works fine.

#5

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

#6

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