I am trying to figure out how to upload a file on an ESP32C3 [which uses the Arduino IDE] to Dropbox. I am using the generic HTTP API as a basis for
doing so. I am effectively converting "curl" commands to Arduino code.
But sods law, I was stopped at the last post. I have list files working, and I have download files working. But uploading, the most important task, is giving me some sort of generic error.
I am trying to convert this line.
curl -X POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer sl.B9dZuDVGsJYG3iabZAIXdK4mzhVom0gdruvL3rHuc4RuxE_BnDlVtjc1lGrrezNGrPqmVNDMXJ5ssKPptz5JNk7Q_MBYZ9pbLdPxmr85Nk3TV0umh9OlivoAjynA9VC6LHrpib2A__8vt1lG6wfST4E" \
--header "Dropbox-API-Arg: {\"autorename\":false,\"mode\":\"add\",\"mute\":false,\"path\":\"/Homework/math/NewImage.jpg\",\"strict_conflict\":false}" \
--header "Content-Type: application/octet-stream" \
--data-binary _5050.jpg
I wrote this in code. The message is generated by the headers I am sending; I don't get to the actual upload of the file, although I am flying by the seat of my pants here. Has anybody done this? Is there something obviously wrong here?
I get this message when I run it. The code 400 means bad request? so one that is syntatically wrong.
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Dropbox - 400</title>
<link href="https://cfl.dropboxstatic.com/static/metaserver/static/css/error.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="https://cfl.dropboxstatic.com/static/images/favicon.ico"/>
</head>
<body>
<div class="figure">
<img src="https://assets.dropbox.com/www/en-us/illustrations/spot/target-miss.svg" alt="Error: 400"/>
</div>
<div id="errorbox">
<h1>Error (400)</h1>Something went wrong. Don't worry, your files are still safe and the Dropbox team has been notified. Check out our <a href="https://status.dropbox.com">Status Page</a> to see if there is a known incident, our <a href="https://www.dropbox.com/help">Help Center</a> and <a href="https://forums.dropbox.com">forums</a> for help, or head back to <a href="https://www.dropbox.com/home">home</a>.
</div>
</body>
</html>