We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

sirhoe's avatar
sirhoe
New member | Level 2
3 years ago

Dropbox API: How to check if user can create shared link without calling create_shared_link_with_set

I build an app and I am would like to proactively inform the user they could not create shared link on a file/folder without them clicking the button and handling the error.    My question is, wh...
  • kylea's avatar
    3 years ago

    The errors returned by sharing/create_shared_link_with_settings give you a good sense of the primary cases to check for.

    • Users must have their email verified in order to share links - else they receive an email_not_verified error. You can check for email verification in users/get_current_account
    • A link may already exist on the file for the user, in which case you may receive a shared_link_already_exists error. You can call sharing/list_shared_links on a path to determine if a link is already present.
    • If content is within a shared folder, the folder owner may have enabled settings that prevent shared links on the content.  You may inspect the settings of a shared folder with sharing/get_folder_metadata
    • Some (non-default) link creation settings are not available to some account types (for example, basic accounts cannot set expiry times).  This is described in more detail in the create link method, and account type returned in get account

    There are potentially rarer exceptions that may cause creating a link to fail that are less introspect-able; you will still want to error handle any 409's from the call.