Skip to content

Latest commit

 

History

History
152 lines (109 loc) · 6.99 KB

sign_requests.md

File metadata and controls

152 lines (109 loc) · 6.99 KB

Sign Requests

Sign Requests are used to request e-signatures on documents from signers.
A Sign Request can refer to one or more Box Files and can be sent to one or more Box Sign Request Signers.

Create Sign Request

The createSignRequest(BoxAPIConnection api, List<BoxSignRequestSigner> signers, List<BoxSignRequestFile> files, String parentFolderId) method will create a Sign Request.

You need to provide 1 to 10 files (from which the signing document will be created) and at least one signer to receive the Sign Request. You can use BoxSignRequestFile and BoxSignRequestSigner classes to provide the necessary data.

List<BoxSignRequestFile> files = new ArrayList<BoxSignRequestFile>();
BoxSignRequestFile file = new BoxSignRequestFile("12345");
files.add(file);
        
// you can also use specific version of the file
BoxFile file = new BoxFile(api, "12345");
List<BoxFileVersion> versions = file.getVersions();
BoxFileVersion firstVersion = versions.get(0);
BoxSignRequestFile file = new BoxSignRequestFile(firstVersion.getFileID(), firstVersion.getVersionID());

List<BoxSignRequestSigner> signers = new ArrayList<BoxSignRequestSigner>();
BoxSignRequestSigner newSigner = new BoxSignRequestSigner("[email protected]");
signers.add(newSigner);

String destinationParentFolderId = "55555";

BoxSignRequest.Info signRequestInfo = BoxSignRequest.createSignRequest(api, files,
        signers, destinationParentFolderId);

createSignRequest allows you to specify optional parameters using the BoxSignRequestCreateParams object.

List<BoxSignRequestFile> files = new ArrayList<BoxSignRequestFile>();
        BoxSignRequestFile file = new BoxSignRequestFile("12345");
        files.add(file);

List<BoxSignRequestSigner> signers = new ArrayList<BoxSignRequestSigner>();
BoxSignRequestSigner newSigner = new BoxSignRequestSigner("[email protected]");
signers.add(newSigner);

String destinationParentFolderId = "55555";

BoxSignRequestCreateParams createParams = new BoxSignRequestCreateParams()
        .setIsDocumentPreparationNeeded(true);

BoxSignRequest.Info signRequestInfo = BoxSignRequest.createSignRequest(api, files,
        signers, destinationParentFolderId, createParams);

If you set isDocumentPreparationNeeded flag to true, you need to visit prepareUrl before the Sign Request will be sent. For more information on isDocumentPreparationNeeded and the other BoxSignRequestCreateParams available, please refer to the developer documentation.

Get All Sign Requests

Calling the static getAll(BoxAPIConnection api, String... fields) will return an iterable that will page through all the Sign Requests.

The static getAll(int limit, BoxAPIConnection api, String... fields) method offers limit and fields parameters. The limit parameter specifies the maximum number of items to be returned in a single response. The fields parameter is used to specify what additional properties should be returned on the BoxSignRequest.Info objects. For more information on what fields are available, please refer to the developer documentation.

Iterable<BoxSignRequest.Info> signRequests = BoxSignRequest.getAll(api);
for (BoxSignRequest.Info signRequestInfo : signRequests) {
	// Do something with each `signRequestInfo`.
}

Get Sign Request by ID

Calling getInfo(String fields ...) will return a BoxSignRequest.Info object containing information about the Sign Request. The fields parameter is used to specify what additional properties should be returned on the BoxSignRequest.Info objects.

BoxSignRequest signRequest = new BoxSignRequest(api, id);
BoxSignRequest.Info signRequestInfo = signRequest.getInfo();

//using `fields` parameter
BoxSignRequest.Info signRequestInfoWithFields = signRequest.getInfo("status")

Cancel Sign Request

Calling cancel() will cancel a created Sign Request.

BoxSignRequest signRequest = new BoxSignRequest(api, id);
BoxSignRequest.Info signRequestInfo = signRequest.getInfo();

signRequestInfo.cancel();

Resend Sign Request

Calling resend() will resend a Sign Request to all signers that have not signed it yet. There is an 10-minute cooling-off period between re-sending reminder emails. If this method is called during the cooling-off period, a BoxAPIException will be thrown.

BoxSignRequest signRequest = new BoxSignRequest(api, id);
BoxSignRequest.Info signRequestInfo = signRequest.getInfo();

signRequestInfo.resend();