cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Using Curl & Dropbox API to upload files to a DB request link

Using Curl & Dropbox API to upload files to a DB request link

Rockymtns99
Explorer | Level 4

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 in the form of https://www.dropbox.com/request/[REDACTED]. The web interface requests a NAME and an EMAIL ADDRESS when I hit upload. 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.

 

something like this:

 

$> ./mydbupload.sh mycoolvideo.mp4

 

I would then edit my script to pass the my argument (ie. mycoolvideo.mp4) into a curl command.

 

Please advise.

 

Thanks!

1 Accepted Solution

Accepted Solutions

Re: Using Curl & Dropbox API to upload files to a DB request link

Здравко
Super Collaborator | 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.

View solution in original post

3 Replies 3

Re: Using Curl & Dropbox API to upload files to a DB request link

Greg-DB
Dropboxer

Dropbox unfortunately doesn't offer a way to programmatically upload to file requests like this, but I'll pass this along as a feature request. I can't promise if or when that might be implemented though.

Re: Using Curl & Dropbox API to upload files to a DB request link

Здравко
Super Collaborator | 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.

View solution in original post

Re: Using Curl & Dropbox API to upload files to a DB request link

Rockymtns99
Explorer | 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.

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Need more support?