I am using the Box Java SDK to upload a file to a folder and create a shared link and send the download URL via email to a customer who has no Box account. I need to ensure that the access to the file is password protected.
Here is my code:
...
BoxFileUploadRequestObject requestObj = BoxFileUploadRequestObject.uploadFileRequestObject(folderEntry.getId(), fileList[j], file, JSON_PARSER);
BoxFile bFile = boxClient.getFilesManager().uploadFile(requestObj);
// create a link to this file
BoxSharedLinkPermissions permissions = new BoxSharedLinkPermissions(true);
BoxSharedLinkRequestObject slo = BoxSharedLinkRequestObject.createSharedLinkRequestObject(BoxSharedLinkAccess.OPEN).setPermissions(permissions);
BoxFileRequestObject bfro = BoxFileRequestObject.createSharedLinkRequestObject(slo);
BoxFile newFile = boxClient.getFilesManager().createSharedLink(bFile.getId(), bfro);
BoxSharedLink link = newFile.getSharedLink();
// get the download URL
String downloadUrl = link.getDownloadUrl();
logger.debug("== BOX_DEBUG_MESSAGE: DownloadUrl = " + downloadUrl);
This all works well but how can I ensure that the link is password protected?