We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.
Forum Discussion
Sharath K.
9 years agoNew member | Level 1
Is it possible to get the share link for a file which has been uploaded to dropbox?
I want to integrate Dropbox with my android app. After authentication when I upload a file to Dropbox I also want to retrieve the share link for that file. Is it possible to get it with metadata? Is it possible to get the share link for a file via api call?
Can somebody help? Thank you.
- Greg-DBDropbox Staff
Here's a simple example that shows how to use that method:
try {
SharedLinkMetadata sharedLinkMetadata = client.sharing().createSharedLinkWithSettings("/test.txt");
System.out.println(sharedLinkMetadata.getUrl());
} catch (CreateSharedLinkWithSettingsErrorException ex) {
System.out.println(ex);
} catch (DbxException ex) {
System.out.println(ex);
} - Greg-DBDropbox Staff
[Cross-linking for reference: https://stackoverflow.com/questions/36861838/is-it-possible-to-get-the-share-link-via-dropbox-api-call-for-a-file-which-has-b ]
You can use the Dropbox API to get a shared link for a file you've uploaded. It isn't included with the file metadata itself, so you just need to make an additional API call.
For example, with Dropbox API v2, you can use the /files/upload endpoint to upload a file:
https://www.dropbox.com/developers/documentation/http/documentation#files-upload
In the Dropbox API v2 Java SDK, that corresponds to the upload method:
Then, you would use the /sharing/create_shared_link_with_settings endpoint, e.g., via the createSharedLinkWithSettings method, to get a shared link for the file:
https://www.dropbox.com/developers/documentation/http/documentation#sharing-create_shared_link_with_settings
https://dropbox.github.io/dropbox-sdk-java/api-docs/v2.0.x/com/dropbox/core/v2/sharing/DbxUserSharingRequests.html#createSharedLinkWithSettings-java.lang.String- - Timotius P.New member | Level 1
I'm trying to do the same thing, and follow link above.
But I still don't know how to create DbxUserSharingRequests instance. Is there any java example for this?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,875 PostsLatest Activity: 3 hours agoIf 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!