Adobe Sign Java SDK
Overview
Adobe Sign SDK aims at providing an easy way to integrate the Adobe Sign RESTful web service into client applications through easy to consume client side objects wrapping the REST API functionality. This repository contains Adobe Sign’s SDK in Java to integrate with Adobe Sign v6 REST APIs.
Table of contents
- Adobe Sign Java SDK
- Overview
- Table of contents
- Prerequisites
- Requirements for Building the SDK
- Getting Started
- Sample SDK Usage
- Documentation for API Endpoints
- Documentation for Models
- Contributing
- Licensing
- Recommendation
- Report Issues/Bugs
Prerequisites
For the building of Adobe Sign Java SDK, the client machine should have the following software installed:
- OS: Windows/Mac/Linux
- Java JDK: version 1.8 or above
- Maven: 3.3.3 version or above
- Gradle: 2.11 version or above
Requirements for Building the SDK
Building the API client library requires Maven for Java 8 or Gradle for Java (8 or above) to be installed.
Installation
To install the API client library to your local repository:
At first generate the JAR either by executing:
mvn package
Then manually install the following JARs:
- target/swagger-java-client-1.0.0.jar
- target/lib/*.jar
or
gradle build
Then manually install the following JARs:
- build/libs/swagger-java-client-1.0.0.jar
Getting Started
The Adobe Sign clients need to follow the below steps in order to get started with it:
-
In order to use the SDK, you need to have an account with Adobe Sign. Please register for a developer account here.
-
Sign in to create an application on the Adobe Sign web portal and obtain it's application id and application secret.
-
Generate the OAuth access token by using the above application id and the application secret. The access token will need to be generated by using the OAuth APIs.
-
Use the generated OAuth access token for trying out the sample API code given below.
Now Please follow the installation instructions and execute the following Java code:
Sample SDK Usage
import java.io.File;
import io.swagger.client.ApiClient;
import io.swagger.client.ApiException;
import io.swagger.client.api.AgreementsApi;
import io.swagger.client.api.BaseUrisApi;
import io.swagger.client.api.TransientDocumentsApi;
import io.swagger.client.model.AgreementCreationResponse;
import io.swagger.client.model.AgreementInfo;
import io.swagger.client.model.BaseUriInfo;
import io.swagger.client.model.FileInfo;
import io.swagger.client.model.ParticipantSetInfo;
import io.swagger.client.model.ParticipantSetMemberInfo;
import io.swagger.client.model.TransientDocumentResponse;
/**
* This sample client demonstrates how to send a new agreement.
* <p>
* <p>
* Following workflow has been implemented here :
* <li> Call base uris api to fetch api access point to invoke further API calls.</li>
* <li> Create a transient document and get transient document id.</li>
* <li> Prepare agreement info and create an agreement using the transient document.</li>
* <li> Send the agreement.</li>
* <li> Display agreement details.</li>
* </p>
*/
public class SendAgreementUsingTransientDocument {
/**
* Entry point for this sample client program.
*/
public static void main(String[] args) {
try {
ApiClient apiClient = new ApiClient();
//Default baseUrl to make GET /baseUris API call.
String baseUrl = "https://api.echosign.com/";
String endpointUrl = "/api/rest/v6";
apiClient.setBasePath(baseUrl + endpointUrl);
//TODO : Provide an OAuth Access Token as "Bearer : access token" in authorization
String authorization = "authorization_example";
//Get the baseUris for the user and set it in apiClient.
BaseUrisApi baseUrisApi = new BaseUrisApi(apiClient);
BaseUriInfo baseUriInfo = baseUrisApi.getBaseUris(authorization);
apiClient.setBasePath(baseUriInfo.getApiAccessPoint() + endpointUrl);
//TODO : Provide path and name of file to be uploaded as transient document
String filePath = "filePath_example";
String fileName = "fileName_example";
File file = new File(filePath + fileName);
String xApiUser = null;
String xOnBehalfOfUser = null;
String mimeType = "application/pdf";
//Get the id of the transient document.
TransientDocumentsApi transientDocumentsApi = new TransientDocumentsApi(apiClient);
TransientDocumentResponse response = transientDocumentsApi.createTransientDocument(authorization, file, xApiUser, xOnBehalfOfUser, fileName, mimeType);
String transientDocumentId = response.getTransientDocumentId();
//prepare request body for agreement creation.
AgreementInfo agreementInfo = new AgreementInfo();
agreementInfo.setName("Sample_Agreement");
agreementInfo.setSignatureType(AgreementInfo.SignatureTypeEnum.ESIGN);
agreementInfo.setState(AgreementInfo.StateEnum.DRAFT);
FileInfo fileInfo = new FileInfo();
fileInfo.setTransientDocumentId(transientDocumentId);
agreementInfo.addFileInfosItem(fileInfo);
ParticipantSetInfo participantSetInfo = new ParticipantSetInfo();
ParticipantSetMemberInfo participantSetMemberInfo = new ParticipantSetMemberInfo();
//TODO : Provide email of recipient to whom agreement will be sent
participantSetMemberInfo.setEmail("email_example");
participantSetInfo.addMemberInfosItem(participantSetMemberInfo);
participantSetInfo.setOrder(1);
participantSetInfo.setRole(ParticipantSetInfo.RoleEnum.SIGNER);
agreementInfo.addParticipantSetsInfoItem(participantSetInfo);
//Create agreement using the transient document.
AgreementsApi agreementsApi = new AgreementsApi(apiClient);
AgreementCreationResponse agreementCreationResponse = agreementsApi.createAgreement(authorization, agreementInfo, xApiUser, xOnBehalfOfUser);
String id = agreementCreationResponse.getId();
//Get agreement info using the agreement id.
String ifNoneMatch = null;
agreementInfo = agreementsApi.getAgreementInfo(authorization, id, xApiUser, xOnBehalfOfUser, ifNoneMatch);
System.out.println("Agreement ID = " + agreementInfo.getId());
System.out.println("Agreement Name = " + agreementInfo.getName());
System.out.println("Agreement Status = " + agreementInfo.getStatus());
}
catch (ApiException e) {
System.err.println(e.toString());
}
}
}
Documentation for API Endpoints
All URIs are relative to https://api.echosign.com/api/rest/v6
Class | Method | HTTP request | Description |
---|---|---|---|
AgreementsApi | addTemplateFieldsToAgreement | POST /agreements/{agreementId}/formFields | Adds template fields to an agreement |
AgreementsApi | createAgreement | POST /agreements | Creates an agreement. Sends it out for signatures, and returns the agreementID in the response to the client. |
AgreementsApi | createAgreementView | POST /agreements/{agreementId}/views | Retrieves the latest state view url of agreement. |
AgreementsApi | createDelegatedParticipantSets | POST /agreements/{agreementId}/members/participantSets/{participantSetId}/delegatedParticipantSets | Creates a participantSet to which the agreement is forwarded for taking appropriate action. |
AgreementsApi | createReminderOnParticipant | POST /agreements/{agreementId}/reminders | Creates a reminder on the specified participants of an agreement identified by agreementId in the path. |
AgreementsApi | createShareOnAgreement | POST /agreements/{agreementId}/members/share | Share an agreement with someone. |
AgreementsApi | deleteDocuments | DELETE /agreements/{agreementId}/documents | Deletes all the documents of an agreement. |
AgreementsApi | getAgreementInfo | GET /agreements/{agreementId} | Retrieves the current status of an agreement. |
AgreementsApi | getAgreementNoteForApiUser | GET /agreements/{agreementId}/me/note | Retrieves the latest note associated with an agreement. |
AgreementsApi | getAgreementReminders | GET /agreements/{agreementId}/reminders | Retrieves the reminders of an agreement, identified by agreementId in the path. |
AgreementsApi | getAgreements | GET /agreements | Retrieves agreements for the user. |
AgreementsApi | getAllDocuments | GET /agreements/{agreementId}/documents | Retrieves the IDs of the documents of an agreement identified by agreementId. |
AgreementsApi | getAllDocumentsImageUrls | GET /agreements/{agreementId}/documents/imageUrls | Retrieves image urls of all visible pages of all the documents associated with an agreement. |
AgreementsApi | getAllMembers | GET /agreements/{agreementId}/members | Retrieves information of members of the agreement. |
AgreementsApi | getAuditTrail | GET /agreements/{agreementId}/auditTrail | Retrieves the audit trail of an agreement identified by agreementId. |
AgreementsApi | getCombinedDocument | GET /agreements/{agreementId}/combinedDocument | Retrieves a single combined PDF document for the documents associated with an agreement. |
AgreementsApi | getCombinedDocumentPagesInfo | GET /agreements/{agreementId}/combinedDocument/pagesInfo | Retrieves info of all pages of a combined PDF document for the documents associated with an agreement. |
AgreementsApi | getDocument | GET /agreements/{agreementId}/documents/{documentId} | Retrieves the file stream of a document of an agreement. |
AgreementsApi | getDocumentImageUrls | GET /agreements/{agreementId}/documents/{documentId}/imageUrls | Retrieves image urls of all visible pages of a document associated with an agreement. |
AgreementsApi | getEvents | GET /agreements/{agreementId}/events | Retrieves the events information for an agreement. |
AgreementsApi | getFormData | GET /agreements/{agreementId}/formData | Retrieves data entered into the interactive form fields of the agreement. |
AgreementsApi | getFormFields | GET /agreements/{agreementId}/formFields | Retrieves details of form fields of an agreement. |
AgreementsApi | getMergeInfo | GET /agreements/{agreementId}/formFields/mergeInfo | Retrieves the merge info stored with an agreement. |
AgreementsApi | getParticipantSet | GET /agreements/{agreementId}/members/participantSets/{participantSetId} | Retrieves the participant set of an agreement identified by agreementId in the path. |
AgreementsApi | getSigningUrl | GET /agreements/{agreementId}/signingUrls | Retrieves the URL for the e-sign page for the current signer(s) of an agreement. |
AgreementsApi | rejectAgreementForParticipation | PUT /agreements/{agreementId}/members/participantSets/{participantSetId}/participants/{participantId}/reject | Rejects the agreement for a participant. |
AgreementsApi | updateAgreement | PUT /agreements/{agreementId} | Updates the agreement in draft state. |
AgreementsApi | updateAgreementMergeInfo | PUT /agreements/{agreementId}/formFields/mergeInfo | Set the merge info for an agreement. |
AgreementsApi | updateAgreementState | PUT /agreements/{agreementId}/state | Updates the state of an agreement identified by agreementId in the path. |
AgreementsApi | updateAgreementVisibility | PUT /agreements/{agreementId}/me/visibility | Updates the visibility of an agreement. |
AgreementsApi | updateFormFields | PUT /agreements/{agreementId}/formFields | Updates form fields of an agreement. |
AgreementsApi | updateParticipantSet | PUT /agreements/{agreementId}/members/participantSets/{participantSetId} | Updates the participant set of an agreement identified by agreementId in the path. |
Documentation for Models
- AgreementCancellationInfo
- AgreementCcInfo
- AgreementCreationResponse
- AgreementDocumentImageUrlsInfo
- AgreementDocuments
- AgreementEvent
- AgreementEventList
- AgreementFormFields
- AgreementInfo
- AgreementRejectionInfo
- AgreementStateInfo
- AgreementView
- AgreementViewInfo
- AgreementViews
- CCParticipantInfo
- CombinedDocumentPagesInfo
- CommonViewConfiguration
- ComposeViewConfiguration
- DelegatedParticipantInfo
- DelegatedParticipantSecurityOption
- DelegatedParticipantSetInfo
- DelegationResponse
- DetailedParticipantInfo
- DetailedParticipantSetInfo
- DeviceLocation
- DigitalSignatureInfo
- DisplayParticipantInfo
- DisplayParticipantSetInfo
- Document
- DocumentImageUrls
- DocumentImageUrlsInfo
- DocumentPageInfo
- DocumentsImageUrlsInfo
- EmailOption
- ExternalId
- FileInfo
- FileUploadOptions
- FormField
- FormFieldConditionPredicate
- FormFieldConditionalAction
- FormFieldHyperlink
- FormFieldLocation
- FormFieldMergeInfo
- FormFieldPostInfo
- FormFieldPutInfo
- MembersInfo
- MergefieldInfo
- Note
- OfflineDeviceInfo
- PageImageUrl
- PageInfo
- ParticipantSecurityOption
- ParticipantSetInfo
- ParticipantSetMemberInfo
- PhoneInfo
- PostSignOption
- ReminderCreationResult
- ReminderInfo
- RemindersResponse
- SecurityOption
- SendOptions
- SenderInfo
- ShareCreationInfo
- ShareCreationInfoList
- ShareCreationResponse
- ShareCreationResponseList
- ShareParticipantInfo
- SigningUrl
- SigningUrlResponse
- SigningUrlSetInfo
- SupportingDocument
- URLFileInfo
- UserAgreement
- UserAgreements
- VaultingInfo
- VisibilityInfo
Contributing
Contributions are welcomed! Read the Contributing Guide for more information.
Licensing
This project is licensed under the Apache V2 License. See LICENSE for more information.
Recommendation
It's recommended to create an instance of ApiClient
per thread and per user (with baseUris fetched for user) in a multithreaded environment to avoid any potential issues.
Report Issues/Bugs
You can report the issues in the issues section of the GitHub repo.