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: 

Get folder links

Get folder links

TheBadger
Explorer | Level 3

Hello, 

I've been tasked with creating shared folders for our team. Each team member will get their own folder that will contain files specific to them. I need a way to collect or create the shared links by automation rather than by copying and pasting as there are currently over 100 team members but this is likely to grow.  Doing it by hand has proven to be time consuming and error prone. 


Is it possible to do this automatically? I have some basic python knowledge but the API documentation is a little difficult. 

 

In the end I would like a csv file listing the folder name and the shared link.   Could someone point me in the right direction on this?

 

With thanks in advance,

James 

3 Replies 3

Re: Get folder links

Greg-DB
Dropboxer

Yes, you can use the Dropbox API to automate the creation of shared links. For Python, we recommend using the official Dropbox API v2 Python SDK:

 

https://github.com/dropbox/dropbox-sdk-python

 

With that, you can use the sharing_create_shared_link_with_settings method to create a shared link for any file or folder:

 

https://dropbox-sdk-python.readthedocs.io/en/latest/api/dropbox.html#dropbox.dropbox_client.Dropbox....

Re: Get folder links

TheBadger
Explorer | Level 3

Sorry I'm obviously not understanding the documentation because I keep getting an error. 

The folder i want the link for is called test it's in the same directory as the python code.

 

the_link = dbx.sharing_create_shared_link_with_settings('/test', settings=None)
print(the_link)

 

 

Traceback (most recent call last):
File "D:\james\Dropbox\Project KMG Instructors\dropbox test.py", line 13, in <module>
the_link = dbx.sharing_create_shared_link_with_settings('/test', settings=None)
File "C:\Users\james\AppData\Local\Programs\Python\Python39\lib\site-packages\dropbox\base.py", line 4060, in sharing_create_shared_link_with_settings
r = self.request(
File "C:\Users\james\AppData\Local\Programs\Python\Python39\lib\site-packages\dropbox\dropbox_client.py", line 346, in request
raise ApiError(res.request_id,
dropbox.exceptions.ApiError: ApiError('21aabc3f746b4a0ca5f079118eb3a353', CreateSharedLinkWithSettingsError('path', LookupError('not_found', None)))

 

Sorry I'm new to all this.

Re: Get folder links

Greg-DB
Dropboxer

The path, "/test" in your code here, should be referring to the path of the file or folder in the Dropbox account, not related to the location of the code you're running.

 

I recommend reading the File Access Guide for reference.

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?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
  • User avatar
    TheBadger Explorer | Level 3
What do Dropbox user levels mean?
Need more support?