Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Joel T.11's avatar
Joel T.11
New member | Level 1
9 years ago

create_shared_link_with_settings with expires in minutes

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

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    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's avatar
    Joel T.11
    New member | Level 1
    9 years ago

    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's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

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

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

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

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!