cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

Create sharing link after file upload

Create sharing link after file upload

Beatso
Explorer | Level 4
Go to solution

I'm using the Javascript SDK, and code uploads some files, creating their parent folders, then creates a sharing link of one of the parent folders. But because javascript is asyncronous, the files haven't been uploaded, hence creating the folder, so creating the sharing link returns a path not found error. How can I get around this problem?

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

The calls in the JavaScript SDK are asynchronous as you mentioned, so if you have additional operation(s) to perform that depend on the result of an earlier call, you should only perform the additional operation(s) once the necessary earlier ones have completed. You can do so by only triggering the later operations once you get the response back from the earlier one. 

 

With the Dropbox JavaScript SDK, you can run code from inside the response function for an API call. So, in this example for instance, that would mean you trigger the next API call from inside the "function(response)" set in the ".then", like how that example appends a message to an element on the page.

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution

The calls in the JavaScript SDK are asynchronous as you mentioned, so if you have additional operation(s) to perform that depend on the result of an earlier call, you should only perform the additional operation(s) once the necessary earlier ones have completed. You can do so by only triggering the later operations once you get the response back from the earlier one. 

 

With the Dropbox JavaScript SDK, you can run code from inside the response function for an API call. So, in this example for instance, that would mean you trigger the next API call from inside the "function(response)" set in the ".then", like how that example appends a message to an element on the page.

Beatso
Explorer | Level 4
Go to solution

thanks!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Beatso Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?