The ability to watermark files and folders is represented as a sub-resource on the Files and Folders resources, respectively. You can think of the sub-resource as a "label" marking whether the file or folder is watermarked or not. If you apply a watermark label to a folder, then all files inside of it will be protected by the watermark (e.g. previews will be watermarked). However, those files' watermark sub-resource is independent from the folder that got watermarked. This allows you to watermark files and folders independently.
- Get Watermark on File
- Apply Watermark on File
- Remove Watermark on File
- Get Watermark on Folder
- Apply Watermark on Folder
- Remove Watermark on Folder
Calling getWatermark(String... fields)
will return a BoxWatermark object containing information about the watermark associated for this file. If the file does not have a watermark applied on it, a 404 Not Found will be returned.
BoxFile file = new BoxFile(api, id);
BoxWatermark watermark = file.getWatermark();
To apply watermark on file, call applyWatermark()
method. While the endpoint accepts a JSON body describing the watermark to apply, custom watermarks are not supported yet.
The method will return a BoxWatermark object containing information about the watermark applied on this file.
BoxFile file = new BoxFile(api, id);
file.applyWatermark();
A watermark can be removed by calling the removeWatermark()
method.
If the file did not have a watermark applied on it, a 404 Not Found will be returned by API.
BoxFile file = new BoxFile(api, id);
file.removeWatermark();
Calling getWatermark(String... fields)
will return a BoxWatermark object containing information about the watermark associated for this folder. If the folder does not have a watermark applied on it, a 404 Not Found will be returned.
BoxFolder folder = new BoxFolder(api, id);
BoxWatermark watermark = folder.getWatermark();
To apply watermark on folder, call applyWatermark()
method.
The method will return a BoxWatermark object containing information about the watermark applied on this folder.
BoxFolder folder = new BoxFolder(api, id);
fodler.applyWatermark();
A watermark can be removed by calling the removeWatermark()
method.
If the folder did not have a watermark applied on it, a 404 Not Found will be returned by API.
BoxFolder folder = new BoxFolder(api, id);
folder.removeWatermark();