Box Java SDK - unable to download / delete specific file versions

I use the latest Box SDK to interact with the API. I can successfully upload, download, delete, and upload a new version of a file.

However, I cannot delete one version of the file from many, as suggested on the SDK page:

BoxDefaultRequestObject requestObj = new BoxDefaultRequestObject();
requestObject.getRequestExtras.setIfMatch(etag); //etag is file version starting from 0
boxClient.getFilesManager().deleteFile(fileId, requestObj);

This does not delete the version and instead deletes the entire file.

Similarly, I cannot download a specific version of the file. Code for download:

BoxDefaultRequestObject downloadReq = new BoxDefaultRequestObject();
downloadReq.getRequestExtras().setIfMatch(versionId);
InputStream is = boxClient.getFilesManager().downloadFile(fileId, downloadReq);

Downloads only the latest version. Can anyone suggest how to make it work?

+4
source share
1 answer

SDK , .

:

boxClient.getFilesManager().deleteFileVersion(fileId, boxVersion, requestObj);

, .

+3

All Articles