简体   繁体   English

上传文件后,Java Dropbox API获取公共共享链接

[英]Java Dropbox API get public share link after uploading file

The following uploads my file to the specified path in dropbox: 以下内容将我的文件上传到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 ? 但是,如何在上传后检索公共共享URL I can't find any documentation. 我找不到任何文件。

Found the right API method: 找到合适的API方法:

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

Couldn't get any easier... 无法轻松......

DbxClient = new DbxClient(config, accessToken);

This call will provide you with a sharable preview Url. 此调用将为您提供可共享的预览Url。

client.createShareableUrl(path);

This call will provide a direct URL. 此调用将提供直接URL。 The only catch is the URL will expire. 唯一的问题是URL将过期。

client.createTemporaryDirectUrl(path);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM