One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
lucasromeiro
7 years agoExplorer | Level 3
Uploading files by ESP8266 HELP
Hello!
I'm trying to access Dropbox to save my files in the cloud using an ESP8266, programming in Arduino!
Has anyone ever managed to do this?
I found an HTTP Developer API page.
Maybe with an HTTP POST I get access, save, delete ....
Currently I already do an HTTP POST for my site. The template for my POST is this:
POST /drome/parser HTTP/1.1\r\nHost: "+String(host)+"\r\nContent-Type: multipart/form-data; boundary=xxBOUNDARYxx\r\nContent-Length: "258"\r\n\r\n--xxBOUNDARYxx\r\nContent-Type: text/plain\r\nContent-Disposition: form-data; name=\"IMEI\"\r\n\r\n"+macAddress()+"\r\n--xxBOUNDARYxx\r\nContent-Type: application/octet-stream\r\nContent-Disposition: form-data; name=\"file\"; filename=\"envio.txt\"\r\n\r\nTEST\r\n--xxBOUNDARYxx--\r\n\r\n
I could not understand the Dropbox API to do this ...
Can someone help me?
Thank you!
- Greg-DB
Dropbox Staff
The Dropbox API does offer the ability to upload files programmatically. For example, you can use /2/files/upload:
https://www.dropbox.com/developers/documentation/http/documentation#files-upload
The documentation there has an example of calling that endpoint via curl. We don't have any resources for Arduino/ESP8266 specifically, but you can translate that example/documentation for whatever HTTPS client you're using.
Also, that's a link to the documentation for the HTTPS endpoint itself, but we recommend using one of the official SDKs if possible:
https://www.dropbox.com/developers/documentation
Those have corresponding native methods for the HTTPS endpoints.- lucasromeiroExplorer | Level 3
Hello can you help me?
it's just an example of how the POST format I'm sending.
then I do not adapt to the dropbox.
above I showed a POST that did not do my project.
Please help me !!! - lucasromeiroExplorer | Level 3
I'm sending this way:
POST /2/auth/token/from_oauth1 HTTP/1.1
Host: api.dropboxapi.com
Content-Type: application/x-www-form-urlencoded
Content-Length: xx
curl -X POST https://api.dropboxapi.com/2/auth/token/from_oauth1 \
--header "Authorization: Basic <MY CODE>" \
--header "Content-Type: application/json" \
--data "{\"oauth1_token\": \"qievr8hamyg6ndck\",\"oauth1_token_secret\": \"qomoftv0472git7\"}"but I get this:
HTTP/1.1 400 Bad Request
Server: nginx
Date: Mon, 23 Apr 2018 04:04:30 GMT
Content-Type: text/html
Content-Length: 264
Connection: close
X-Frame-Options: DENY
Content-Security-Policy: sandbox; frame-ancestors 'none'
X-Content-Type-Options: nosniff
Content-Disposition: attachment; filename='error'
can you help me ???
I can not make progress.
thank you!- Greg-DB
Dropbox Staff
From the sample you provided, I see that you're trying to call /2/auth/token/from_oauth1, but are just using the oauth1_token and oauth1_token_secret values from the documentation itself. This endpoint is only meant for use if you already have pre-existing OAuth 1 access tokens, which you would plug in there instead of the sample values from the documentation. If you are only starting development now, you would not have OAuth 1 access tokens and so should not be using this endpoint.
If you don't have pre-existing OAuth 1 access tokens, you should send the user through the normal OAuth 2 app authorization flow. You can find information on how that works in the OAuth guide here:
https://www.dropbox.com/developers/reference/oauth-guide
The documentation for the OAuth 2 app authorization flow can be found here:
https://www.dropbox.com/developers/documentation/http/documentation#authorization
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,949 PostsLatest Activity: 5 minutes ago
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!