This SDK is now deprecated and will no longer receive feature updates or bug fixes. Security fixes will still be applied as needed.
The new dropbox-sign SDK can be found at hellosign/dropbox-sign-java!
The new SDK and this legacy SDK are not backwards-compatible!
Please see here for a comprehensive migration guide.
Get your Java app connected to HelloSign's API in jiffy.
To build this project you'll need JDK 9+ but the release artifacts support JRE 8+.
SDK releases are published to Maven's Central repository:
<dependency>
<groupId>com.hellosign</groupId>
<artifactId>hellosign-java-sdk</artifactId>
<version>RELEASE</version>
</dependency>Releases can also be consumed using other build tools that support Maven Central.
Gradle for example:
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.hellosign', name: 'hellosign-java-sdk', version:'RELEASE'
}Alternatively, you can build the JAR yourself:
./gradlew jar
or a fatJar with all dependencies if you'd like:
./gradlew fatJar
Place build/libs/hellosign-java-sdk-<VERSION>.jar on your project classpath.
First initialize an instance of the HelloSignClient with your API key:
HelloSignClientclient = newHelloSignClient(apiKey);SignatureRequestrequest = newSignatureRequest();
request.setSubject("NDA");
request.setMessage("Hi Jack, Please sign this NDA and let's discuss.");
request.addSigner("jack@example.com", "Jack");
request.addFile(newFile("nda.pdf"));
SignatureRequestresponse = client.sendSignatureRequest(request);
System.out.println(response.toString());SignatureRequestrequest = newSignatureRequest();
Documentdoc = newDocument();
doc.setFile(newFile("/path/to/myfile.pdf")));
FormFieldtextField = newFormField();
textField.setType(FieldType.TEXT);
textField.setName("First Name"); // Displayed to the signer as the "Field Label"textField.setValidationType(ValidationType.letters_only);
textField.setSigner(0); // Signer indexes are zero-basedtextField.setHeight(25);
textField.setWidth(300);
textField.setIsRequired(true);
textField.setPage(1); // 1-based indexing, relative to the documenttextField.setX(100);
textField.setY(100);
doc.addFormField(textField);
request.addDocument(doc);TemplateListtemplateList = client.getTemplates();
for (Templatetemplate : templateList) {
System.out.println(template.getTitle());
}Or filter the paged list:
TemplateListtemplateList = client.getTemplates();
List<Template> filteredList = templateList.filterCurrentPageBy(Template.TEMPLATE_TITLE, "W-2 Template");
for (Templatetemplate : filteredList) {
System.out.println(template.getTitle());
}TemplateSignatureRequestrequest = newTemplateSignatureRequest();
request.setTemplateId(templateId);
request.setSigner("Client", "george@example.com", "George");
request.setCC("Accounting", "accounting@hellosign.com");
request.addCustomFieldValue("Cost", "$20,000");
SignatureRequestresponse = client.sendTemplateSignatureRequest(request);
System.out.println(response.toString());While we encourage you to take advantage of our callback functionality, you can also retrieve the status of a specific request:
SignatureRequestresponse = client.getSignatureRequest(signatureRequestId);
if (response.isComplete()) {
System.out.println("All signers have signed this request.");
} else {
for (Signaturesignature : response.getSignatures()) {
System.out.println(signature.getStatusString());
}
}The MIT License (MIT)
Copyright (C) 2020 hellosign.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.