cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

create_shared_link_with_settings with expires in minutes

create_shared_link_with_settings with expires in minutes

Joel T.11
New member | Level 1

Hi

How to expire a shared link in 1 minutes? I'm trying but doesn't work, when i try with days works properly.

Sorry for my english

Thanks

4 Replies 4

Greg-DB
Dropbox Staff

Setting the expiration to 1 minute in the future is working fine for me. Can you share your code and the error you're getting? Thanks in advance! 

Joel T.11
New member | Level 1

Hi

I'm getting this error:

dropbox.exceptions.ApiError: ('b5fdf345d4f997fe803468c16f5ceba0', CreateSharedLinkWithSettingsError('settings_error', SharedLinkSettingsError('invalid_settings', None)))

Code:

import datetime
import dropbox

dbx = dropbox.Dropbox(APP_TOKKEN)
expires = datetime.datetime.now() + datetime.timedelta(minutes=1)
shared_link_settings = dropbox.sharing.SharedLinkSettings(expires=expires)
shared_link_metadata = dbx.sharing_create_shared_link_with_settings("/test.txt", settings=shared_link_settings)
print(shared_link_metadata)

Thanks for helping me

Greg-DB
Dropbox Staff

Thanks Joel, that's helpful. The API expects UTC, so you should instead do:

expires = datetime.datetime.utcnow() + datetime.timedelta(minutes=1)

Joel T.11
New member | Level 1

Its works!

Thank you so much

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Joel T.11 New member | Level 1
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?