Wednesday 7 September 2016

How to Combine Documents through Docusign APIs

This time I got a chance to play with inner world of Docusign. Always I prefer REST API but this time SOAP saved my life.

I had a challenge to combine all signed document in single enevelope ( condition is you can not get it through Docusign configs settings because that is common for) so I have used soap api this time over rest ( was giving me Time out error).
Required Data:  Docusign Credential , Integrator Key & EnevelopId.

Firstly created a class 'DocusignSOAPfromWSDL_Cls' trough wsdl file then written our logic to get all document in combined format. Below is my code snippet:


// To Set endpoit URL
dsApiSend.endpoint_x = 'https://demo.docusign.net/api/3.0/dsapi.asmx';

// To Set Authentication
String auth = '<DocuSignCredentials>
                                <Username>'+ DocusignUserName+'</Username>
                                <Password>' + DocusignPassword + '</Password>
                                <IntegratorKey>' + Docusign_IntegratorKey + '</IntegratorKey>                                                 </DocuSignCredentials>';

// To Set Headers        
dsApiSend.inputHttpHeaders_x = new Map<String, String>();
dsApiSend.inputHttpHeaders_x.put('X-DocuSign-Authentication',auth);      

//Interating all incoming docusign status records
 DocusignSOAPfromWSDL_Cls.EnvelopePDF combinedPDF = dsApiSend.RequestPDFNoWaterMark(docusignEnvelopeID);
       Attachment combinedDocument =  new attachment(
                                           Body=EncodingUtil.base64Decode(combinedPDF.PDFBytes),
                                           Name= AttachmentName+'.pdf',
                                           parentId= ParentRecordId
                                    );
      insert combinedDocument ;

This is how you may combine all signed document through Docusign.

1 comment:

  1. Casino - Biloxi, MS - JTAHub
    Casino - Biloxi, MS - 부천 출장샵 JTG Hub has the largest selection of casino 세종특별자치 출장마사지 and 전라북도 출장안마 slot machines in Biloxi. Get the 충청북도 출장샵 latest 충청남도 출장안마 gaming, slot games and live entertainment.

    ReplyDelete