You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
prrvchr
2 months agoExplorer | Level 4
I can no longer upload files
Hi all, For some time now I have not been able to upload my files via the HTTP API. The file/upload or file/get_temporary_upload_link gives me a 404 error even though it worked perfectly until n...
prrvchr
2 months agoExplorer | Level 4
Ok the CURL header that seems to be no longer supported is:
--header "Accept-Encoding: gzip, deflate" \
How is this possible?
- Greg-DB2 months agoDropbox Staff
I just gave this a try myself, but I'm not getting back a 404 error when I use that header. Can you share the full request and response for this issue so we can take a look? If you're using curl, use the -v option to enable verbose mode. Please redact your access token though. Thanks in advance!
- prrvchr2 months agoExplorer | Level 4
Hi Greg,
No, it doesn't come from the headers, sorry.
I can get this Curl query to work correctly:
curl -X POST https://content.dropboxapi.com/2/files/upload \ --header "Authorization: Bearer sl.B_2..." \ --header "Dropbox-API-Arg: {\"autorename\":false,\"mode\":\"overwrite\",\"mute\":false,\"path\":\"/Test Dropbox.odt\",\"strict_conflict\":false}" \ --header "User-Agent: python-requests/2.25.1" \ --header "Accept-Encoding: gzip, deflate" \ --header "Accept: */*" \ --header "Connection: keep-alive" \ --header "Content-Type: application/octet-stream" \ --write-out "%{http_code}\n" \ --data-binary "@/home/prrvchr/Test Dropbox.odt"
On the other hand, if I use Python/Requests instead of Curl, it gives me a 404:
import requests url = 'https://content.dropboxapi.com/2/files/upload' headers = {'Content-Type': 'application/octet-stream', 'Dropbox-API-Arg': '{"autorename": false, "mode": "overwrite", "mute": false, "path": "/Test Dropbox.odt", "strict_conflict": false}', 'Authorization': 'Bearer sl.B_2...'} data = open('/home/prrvchr/Test Dropbox.odt', 'rb') response = requests.put(url, headers=headers, data=data) print("Status Code: %s" % response.status_code) response.close() data.close()
I don't see why...
- Greg-DB2 months agoDropbox Staff
Thanks for following up and sharing that. In your Python code, you're using the "PUT" method, via the ".put" call, however the /2/files/upload endpoint expects a "POST". That would be ".post" in the requests library.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,915 PostsLatest Activity: 17 minutes agoIf 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!