Ho to get publicly referenced URL to a file?
We are integrating Salesforce to box to upload/view file, I was able to upload and download files in APEX using box REST API but we have a requirement to get a publicly referenced URL on page where users click on that and open file withtout asking authorization permissions, how could we do that using Box API?
Appreciate your help.
Sumant K
-
Here's an example of creating an OPEN shared link using the Box Java SDK.
In this example, since it's open, we set it ot expire in 14 days but you don't have to.
private static BoxSharedLink createSharedLink(BoxAPIConnection api, String fileId) { BoxFile file = new BoxFile(api, fileId); BoxSharedLink.Permissions permissions = new BoxSharedLink.Permissions(); permissions.setCanDownload(true); permissions.setCanPreview(true); Date date = new Date(); Calendar unshareAt = Calendar.getInstance(); unshareAt.setTime(date); unshareAt.add(Calendar.DATE, 14); BoxSharedLink sharedLink = file.createSharedLink(BoxSharedLink.Access.OPEN, unshareAt.getTime(), permissions); logger.info("shared link: " + sharedLink.getURL()); return sharedLink; }
サインインしてコメントを残してください。
コメント
2件のコメント