Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Florian K.8
10 years agoNew member | Level 1
How do I create a shared link with expiry date from API (Python SDK)?
9 Replies
Replies have been turned off for this discussion
- Greg-DB10 years ago
Dropbox Community Moderator
The Dropbox API doesn't currently offer a way to set a custom expiration on shared links, but I'll be sure to pass this along as a feature request.
- Peter K.1110 years agoNew member | Level 1
what about setting the password on shared links ?
- Greg-DB10 years ago
Dropbox Community Moderator
That's also not currently available, but I'll pass that along as a request as well.
- Daniel B.709 years agoNew member | Level 1
Is there any expected/known timeline for this?
Thanks!
- Greg-DB9 years ago
Dropbox Community Moderator
This is now possible using the /sharing/create_shared_link_with_settings endpoint on API v2:
In the latest version of the Python SDK, that's the sharing_create_shared_link_with_settings method:
- Daniel B.709 years agoNew member | Level 1
Oh! great, I was looking at v1 docs. Thank you very much!
- Russell A.19 years agoNew member | Level 1
sorry to revive this, but can someone show an example of how to pass settings here? Like:
dbx = dropbox.Dropbox("KEY")
dbx.users_get_current_account()
print dbx.sharing_create_shared_link_with_settings('link/to/share', ????)I'm not sure how to pass the settings, like requested_visibility or link_password.
- Greg-DB9 years ago
Dropbox Community Moderator
Sure, this creates a shared link for a file and also supplies a requested visibility and expiration in the settings:
import datetime
import dropbox
dbx = dropbox.Dropbox("<ACCESS_TOKEN>")
expires = datetime.datetime.now() + datetime.timedelta(days=30)
requested_visibility = dropbox.sharing.RequestedVisibility.team_only
desired_shared_link_settings = dropbox.sharing.SharedLinkSettings(requested_visibility=requested_visibility, expires=expires)
shared_link_metadata = dbx.sharing_create_shared_link_with_settings("/test.txt", settings=desired_shared_link_settings)
print(shared_link_metadata)<ACCESS_TOKEN> should be replaced with the access token.
The dropbox.sharing.SharedLinkSettings constructor also takes a link_password parameter.
- Russell A.19 years agoNew member | Level 1
okay that's great. thank you so much. that really put that in perspective!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If 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, Facebook or Instagram.
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!