Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I'm having trouble getting a shareable link from a file through the Dropbox API. This is the entirety of my code:
import os import dropbox dbx = dropbox.Dropbox('access token') myPath = os.path.join("E:\\Dropbox\\DUNESBURY NEW ITEM PICS\\2019\\01 January\\Originals\\Flowers\\DSC_0247.NEF")
dbx.sharing_create_shared_link(path = myPath, short_url=False, pending_upload=None)
This throws the error:
dropbox.exceptions.ApiError: ApiError('dd1d6711a935e6b6fd04c192fd58bfca', CreateSharedLinkError('path', LookupError('malformed_path', None)))
I'm trying to get this script to print links like this: https://www.dropbox.com/s/fcdljiu8hjv3g7u/DSC_0247.NEF?dl=0, and write them to a .txt file, so I can automate the process for us getting links out of Dropbox.
Am I on the right track? How can I resolve this error?
When you make a Dropbox API call like this and supply a path, you should supply the path to the remote file on Dropbox, relative to the root of the Dropbox account.
In the code you shared here, you're instead sharing a path to the local file, which isn't a valid path for the Dropbox API.
That is, based on the sample you shared, the path value should instead look like:
"/DUNESBURY NEW ITEM PICS/2019/01 January/Originals/Flowers/DSC_0247.NEF"
(You can get these values from elsewhere on the API, such as in Metadata.path_lower, e.g,. as returned by files_list_folder.)
Hi there!
If you need more help you can view your support options (expected response time for a 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!