Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

lmbrvill's avatar
lmbrvill
Explorer | Level 3
8 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!

 

4 Replies

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago

    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
    8 years ago

    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 Community Moderator rankDropbox Community Moderator
    8 years ago
    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.

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!