You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

kostas k.7's avatar
kostas k.7
Explorer | Level 4
9 years ago

shared_link_already_exists

Hello,

There is an 409 (Conflict) error i have never encountered since today with a responseText "shared_link_already_exists".

I have a generic function getDropboxFiles() called in several places in my web app that creates a "list_folder" request, mainly when the user logs into the page or if a new file is uploaded.

When the request completes successfully i grab the response and for each file i create a "create_shared_link_with_settings" request and add it to my page , so that the user can open each file seperately.

 

Today is the first day, after a long time that the app works like a charm with no problems, that i receive the above error message. Can you provide some insight please ? Thank you in advance.

 

  • When calling /2/sharing/create_shared_link_with_settings a shared_link_already_exists error is expected if a shared link already exists for that path.

     

    This can occur, for example, if your app already made that API call for that path. Is it possible your app ran that code more than once for a particular path?

     

    If can also occur if the user elsewhere made a link for that file or folder though, even outside of your app, e.g., via the Dropbox web site.

     

    That being the case, you should make sure your app is ready to handle that error. You can use /2/sharing/list_shared_links with direct=true to get the existing link.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    When calling /2/sharing/create_shared_link_with_settings a shared_link_already_exists error is expected if a shared link already exists for that path.

     

    This can occur, for example, if your app already made that API call for that path. Is it possible your app ran that code more than once for a particular path?

     

    If can also occur if the user elsewhere made a link for that file or folder though, even outside of your app, e.g., via the Dropbox web site.

     

    That being the case, you should make sure your app is ready to handle that error. You can use /2/sharing/list_shared_links with direct=true to get the existing link.

    • kostas k.7's avatar
      kostas k.7
      Explorer | Level 4

      Thank you my friend, this helped a lot.

       

      I called the "create_shared_link_with_settings" when the user clicked on file Test1 for example, so it could be downloaded from his dropbox account to my app. If the user then wanted to see file Test2 i did the same, and if he/she wanted to go back to Test1 the shared_link as you said already existed.

       

      I used the "get_temporary_link" to grab the link of a file, that expires in 4 hours, so it seems that it will do the trick.

      Thank you again.

    • anibale's avatar
      anibale
      New member | Level 2

      Yours response is "409 (Conflict) error", how can i know that authentic error is "shared_link_already_exists"?

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        anibale When you get a 409 like this, you should check the HTTP response body. It will contain a more specific error, such as shared_link_already_exists. (If you're using an SDK, the SDK will translate this into an error type for you.)