ThatGuy343
ThatGuy343

Reputation: 2424

Java Dropbox API get public share link after uploading file

The following uploads my file to the specified path in dropbox:

DbxEntry.File uploadedFile = client.uploadFile("/" + id + "/name" + ".png",
DbxWriteMode.add(), tile.length(), inputStream);
System.out.println("Uploaded: " + uploadedFile.toString());

However how can i retrieve the Public Share URL after it is uploaded? I can't find any documentation.

Upvotes: 4

Views: 2941

Answers (2)

sudhir shakya
sudhir shakya

Reputation: 897

DbxClient = new DbxClient(config, accessToken);

This call will provide you with a sharable preview Url.

client.createShareableUrl(path);

This call will provide a direct URL. The only catch is the URL will expire.

client.createTemporaryDirectUrl(path);

Upvotes: 1

ThatGuy343
ThatGuy343

Reputation: 2424

Found the right API method:

DbxClient = new DbxClient(config, accessToken);
client.createShareableUrl(path)

Couldn't get any easier...

Upvotes: 7

Related Questions