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

lmbrvill's avatar
lmbrvill
Explorer | Level 3
7 years ago

create_shared_link_with_settings works once, then returns nothing

Hey all - would love some help. If anyone is working with the Kunnu PHP sdk:

 

The following:

$response = $dropbox->postToAPI("/sharing/create_shared_link_with_settings", ["path" => "/path/to/file.txt"]);

$data = $response->getDecodedBody();

var_dump($data);

 

works once, then stops. 

 

I'm assuming that has to do with the expiration time? Any way to set the expiration to be a minute or less? I'm testing and need to send a few requests in a row. Or is it something else?

 

Thanks in advance!

 

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

    I can't help with the third party library itself, but can you clarify what you mean you say it "stops"? The Dropbox API itself should always return a response, whether that's a successful result, or an error. You should check how you can retrieve an error result from the library.

     

    For example, if you're calling for the same path multiple times, the issue is likely that /2/sharing/create_shared_link_with_settings returns a shared_link_already_exists error when there's already a shared link for that file/folder.

     

    You should check how to catch that using that library, and then instead call /2/sharing/list_shared_links using direct_only=true to retrieve the existing shared link.

     

     

    • lmbrvill's avatar
      lmbrvill
      Explorer | Level 3

      Aha!

       

      Ok got it - list_shared_links is what I needed thank you!

       

      Is there a method to generate a permanent link?

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff
        The links returned by /2/sharing/create_shared_link_with_settings (and list_shared_links) are the closest to "permanent" links. They don't expire by default, though users/apps can explicitly revoke them or set an expiration.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 12 months ago
325 Following

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 or Facebook.

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!