cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox 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: 

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

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

sirhoe
New member | Level 2
Go to solution

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, what API should I check to achieve that? 

1 Accepted Solution

Accepted Solutions

kylea
Dropbox Staff
Go to solution

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.

View solution in original post

1 Reply 1

kylea
Dropbox Staff
Go to solution

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.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    kylea Dropbox Staff
What do Dropbox user levels mean?