cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right 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
Go to solution

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

Здравко
Legendary | Level 20
Go to solution

@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. :slightly_smiling_face:

 


@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! :winking_face:

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. :ok_hand: "bash" is powerful enough to parse the query containing code/token/etc.

Hope this gives idea.

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

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.

Здравко
Legendary | Level 20
Go to solution

@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. :slightly_smiling_face:

 


@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! :winking_face:

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. :ok_hand: "bash" is powerful enough to parse the query containing code/token/etc.

Hope this gives idea.

Rockymtns99
Explorer | Level 4
Go to solution

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.

TTimo
Helpful | Level 5
Go to solution

This would be very useful!

Need more support?