Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Rockymtns99
5 years agoExplorer | Level 4
Using Curl & Dropbox API to upload files to a DB request link
I am wanting to create a BASH script in Linux to use when I need to load media files to a Dropbox request link that a group of mine uses for collaboration. How would I do this with curl? The link is ...
- 5 years ago
Rockymtns99 wrote:I am wanting to create a BASH script ... to load media files to a Dropbox request link ... How would I do this with curl? ...
Hi Rockymtns99,
I don't think it's possible in such a way. If this was possible, that would be a throughput way for something like spam. 🙂
Rockymtns99 wrote:... Can I just parse that in with the API? Is this a feasible task to accomplish? I am usually in a terminal shell and I could save myself time by just running a script to upload the file without having to jump into a browser. ...
Good questions and good idea! 😉
Unfortunately, there isn't a bash SDK. You can create something without SDK by using direct calls to curl, actually. Following API documentation, the simplest way is to create, by hand, a refresh token and save it in some configuration file. Next in your script you can read the refresh token, saved before, and using /oauth2/token call receive access token. Using the access token you can call all other API calls. It expires relatively soon, stays valid more than enough. Using /upload call smaller files could be uploaded directly. For bigger files (more than 150MB) you should gonna create upload session using /upload_session/start call and following calls.
For more sophisticated script, you can create a pseudo server using netcat to perform OAuth flow in addition to curl usage. 👌 "bash" is powerful enough to parse the query containing code/token/etc.
Hope this gives idea.
Здравко
5 years agoLegendary | Level 20
Rockymtns99 wrote:I am wanting to create a BASH script ... to load media files to a Dropbox request link ... How would I do this with curl? ...
Hi Rockymtns99,
I don't think it's possible in such a way. If this was possible, that would be a throughput way for something like spam. 🙂
Rockymtns99 wrote:... Can I just parse that in with the API? Is this a feasible task to accomplish? I am usually in a terminal shell and I could save myself time by just running a script to upload the file without having to jump into a browser. ...
Good questions and good idea! 😉
Unfortunately, there isn't a bash SDK. You can create something without SDK by using direct calls to curl, actually. Following API documentation, the simplest way is to create, by hand, a refresh token and save it in some configuration file. Next in your script you can read the refresh token, saved before, and using /oauth2/token call receive access token. Using the access token you can call all other API calls. It expires relatively soon, stays valid more than enough. Using /upload call smaller files could be uploaded directly. For bigger files (more than 150MB) you should gonna create upload session using /upload_session/start call and following calls.
For more sophisticated script, you can create a pseudo server using netcat to perform OAuth flow in addition to curl usage. 👌 "bash" is powerful enough to parse the query containing code/token/etc.
Hope this gives idea.
- Rockymtns995 years agoExplorer | Level 4
Thanks. That makes sense. I was hoping that there would be an easy way to call a curl command from a script to do quick uploads to the request link but, it sounds like it isn't as simple as I thought.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
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, Facebook or Instagram.
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!