download-the-agreement

Once an agreement is signed, your application can retrieve the signed copy of the all associated documents and store them locally:

//Populate the headers
//Note that MultivaluedMap is part of javax.ws.rs.core package
//Note that MultivaluedMapImpl is part of com.sun.jersey.core.util package
MultivaluedMap headers = new MultivaluedMapImpl();  
String ACCESS_TOKEN_KEY= "Access-Token";  
String X_API_USER_KEY = "x-api-user";   
headers.put(ACCESS_TOKEN_KEY, "hajUhhsNottheRealTokenjKh");    
headers.put(X_API_USER_KEY, "me@mycomp.com");

//Fetch the list of documents associated with the specified agreement.   
AgreementDocuments agreementDocuments = agreementsApi.getAllDocuments(headers, agreementId, null, null, null);

List agreementDocumentsList = agreementDocuments.getDocuments();   

for (Document document : agreementDocumentsList) {      
    //Download all the documents of the given agreement      
    byte docStream[] = agreementsApi.getDocument(headers, agreementId, document.getDocumentId());
    
    //Save the documents to file.      
    if (docStream != null) {            
        //Save the docStream byte array to a local file.
        ...
    }
}