We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
jimbob1977
5 years agoHelpful | Level 6
Automate DropBox Using Script
Hi
I am working on a project that requires sharing of video files to different recipients.
I therefor need to use script to...
- Upload a file from my local folder
- Share the file + get down...
- 5 years ago
Hi jimbob1977,
If you run Linux, the best place of your question isn't API section. You can get link to arbitrary file in the Dropbox folder using CLI. Take a look on "sharelink" command. :wink:
Unfortunately, CLI is available only on Linux, so if you run something else, this advice isn't for you (or at least, if you don't plane switch to Linux).
Hope this helps to some extent.
Greg-DB
5 years agoDropbox Staff
To create a shared link via the Dropbox API, you should use the /2/sharing/create_shared_link_with_settings endpoint:
That allows you to specify a file or folder and returns a shared link for it. You can then use the link as desired, e.g., to send it to someone. They can then download the linked file or folder from it.
Or, to retrieve already existing shared links, you can use /2/sharing/list_shared_links:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-list_shared_links
By the way, those are links to the documentation for the HTTPS endpoints themselves, but we recommend using one of the official SDKs if possible:
https://www.dropbox.com/developers/documentation
Those have corresponding native methods for the HTTPS endpoints.
- jimbob19775 years agoHelpful | Level 6
Hi Greg
Thanks for your help. I've been looking through the API Descriptions and experimented with the API Explorer.
Think I'm missing the p[oint somewhere???
To upload a file I am using...
curl -X POST https://content.dropboxapi.com/2/files/upload \ --header 'Authorization: Bearer MYAUTHCODE' \ --header 'Content-Type: application/octet-stream' \ --header 'Dropbox-API-Arg: {"path":"/MyLocalFolder/Clown.jpeg"}'
When I run this I get the error...
{"error_summary": "path/conflict/file/...", "error": {".tag": "path", "reason": {".tag": "conflict", "conflict": {".tag": "file"}}, "upload_session_id": "AAAAAAAAA_Hm7Dp23cYtfg"}
The file doesnt exist on my dropbox and is less than 150MB
Any ideas as to where I'm going wrong??
- jimbob19775 years agoHelpful | Level 6
OK - So I've seen the error of my ways.
To clarify...
The path - is the path withinmy dropbox Apps folder where the file will be located - Correct???
Stupid Question - how does it know which file to upload ?? or isd it as simple as it finds a file by same name on local drive?
- Greg-DB5 years agoDropbox Staff
The "path" parameter you specify is the path in the Dropbox account where you want to put the uploaded file. If your app uses the "app folder" permission, that path will be used relative to the app folder.
The "path/conflict/file" error indicates that there's already something at the specified path, so the upload couldn't complete. Check out the /2/files/upload "mode" parameter documentation for information on configuring what happens in that case.
The "path" parameter value is only used to specifying where to upload the file in Dropbox. It is not used to find or specify what data to upload. The data for the file upload is whatever you send in the request body. When using curl on the command line like this, you can specify that data via curl's "--data-binary" option. There's an example of doing so included in the /2/files/upload documentation.
About Discuss Dropbox Developer & API
Make connections with other developers
795 PostsLatest Activity: 7 days 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!