Skip to content

Latest commit

 

History

History
99 lines (70 loc) · 4.19 KB

watermarking.md

File metadata and controls

99 lines (70 loc) · 4.19 KB

Watermarking

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

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();

Apply Watermark on File

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();

Remove Watermark on File

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();

Get Watermark on Folder

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();

Apply Watermark on Folder

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();

Remove Watermark on Folder

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();