Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(Tcl) Send DocuSign XML RequestDemonstrates how to send a DocuSign XML request. Important:This example requires Chillkat v9.5.0.75 or greater.
load ./chilkat.dll # This requires the Chilkat API to have been previously unlocked. # See Global Unlock Sample for sample code. set req [new_CkHttpRequest] CkHttpRequest_put_HttpVerb $req "POST" # Replace "12999999" with your own account number. (12999999 is a ficticious account number) CkHttpRequest_put_Path $req "/restapi/v2/accounts/12999999/envelopes" CkHttpRequest_AddHeader $req "Accept" "application/xml" # Don't worry about the boundary string. Chilkat will automatically generate one and include it. CkHttpRequest_put_ContentType $req "multipart/form-data" set xmlCred [new_CkXml] CkXml_put_Tag $xmlCred "DocuSignCredentials" CkXml_UpdateChildContent $xmlCred "Username" "YOUR_DOCUSIGN_USERNAME" CkXml_UpdateChildContent $xmlCred "Password" "YOUR_DOCUSIGN_PASSWORD" CkXml_UpdateChildContent $xmlCred "IntegratorKey" "ABCD-12345678-1234-AAAA-BBBB-abcdabcdabcd" CkXml_put_EmitXmlDecl $xmlCred 0 CkXml_put_EmitCompact $xmlCred 1 CkHttpRequest_AddHeader $req "X-DocuSign-Authentication" [CkXml_getXml $xmlCred] # Don't worry about Host or Content-Length headers, Chilkat automatically adds them... # Build the XML for the 1st body part.. set xml [new_CkXml] CkXml_put_Tag $xml "envelopeDefinition" CkXml_AddAttribute $xml "xmlns" "http://www.docusign.com/restapi" CkXml_UpdateChildContent $xml "emailSubject" "Signature Request: Test Test:001019:033611" CkXml_UpdateChildContent $xml "status" "sent" CkXml_UpdateChildContent $xml "documents|document|documentId" "1" CkXml_UpdateChildContent $xml "documents|document|name" "001019_TestTest_RetailDeals_163357" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|hostEmail" "admin@chilkatsoft.com" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|hostName" "Chilkat Admin" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|signerName" "Test Test" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|recipientId" "1" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|routingOrder" "1" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|signerEmail" "test@tyest.com" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|anchorString" "\\SDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|optional" "False" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|anchorString" "\\OSDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|optional" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|anchorString" "\\OPSSDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|optional" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|scaleValue" "0.7" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|anchorString" "\\PSSDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|optional" "False" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|scaleValue" "0.7" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|anchorString" "\\IDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|optional" "False" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|anchorString" "\\OIDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|optional" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|anchorString" "\\OPSIDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|optional" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|scaleValue" "0.5" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|anchorString" "\\PSIDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|optional" "False" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|scaleValue" "0.5" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|hostEmail" "admin@chilkatsoft.com" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|hostName" "Chilkat Admin" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|signerName" "Dealer Representative" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|recipientId" "2" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|routingOrder" "2" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|anchorString" "\\DSDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|optional" "False" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|anchorString" "\\DOSDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|optional" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|anchorString" "\\DIDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|optional" "False" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|anchorIgnoreIfNotPresent" "True" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|anchorString" "\\DOIDP" CkXml_UpdateChildContent $xml "recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|optional" "True" CkXml_put_EmitXmlDecl $xml 0 puts [CkXml_getXml $xml] CkXml_put_EmitCompact $xml 1 # IMPORTANT: This example requires Chilkat v9.5.0.75 or greater. CkHttpRequest_AddStringForUpload2 $req "" "" [CkXml_getXml $xml] "utf-8" "application/xml" CkHttpRequest_AddFileForUpload2 $req "" "qa_data/pdf/signatureForm.pdf" "application/pdf" CkHttpRequest_AddSubHeader $req 1 "Content-Disposition" "file; filename=\"signatureForm.pdf\";documentid=1" set http [new_CkHttp] CkHttp_put_SessionLogFilename $http "qa_output/log.txt" # resp is a CkHttpResponse set resp [CkHttp_SynchronousRequest $http "na2.docusign.net" 443 1 $req] if {[CkHttp_get_LastMethodSuccess $http] != 1} then { puts [CkHttp_lastErrorText $http] delete_CkHttpRequest $req delete_CkXml $xmlCred delete_CkXml $xml delete_CkHttp $http exit } if {[CkHttpResponse_get_StatusCode $resp] != 201} then { puts [CkHttpResponse_bodyStr $resp] puts "Response status code: [CkHttpResponse_get_StatusCode $resp]" puts "Failed." delete_CkHttpResponse $resp delete_CkHttpRequest $req delete_CkXml $xmlCred delete_CkXml $xml delete_CkHttp $http exit } # Examine the response.. CkXml_LoadXml $xml [CkHttpResponse_bodyStr $resp] set envelopeId [CkXml_getChildContent $xml "envelopeId"] puts "envelopeId = $envelopeId" set status [CkXml_getChildContent $xml "status"] puts "status = $status" set statusDateTime [CkXml_getChildContent $xml "statusDateTime"] puts "statusDateTime = $statusDateTime" set uri [CkXml_getChildContent $xml "uri"] puts "uri = $uri" delete_CkHttpResponse $resp delete_CkHttpRequest $req delete_CkXml $xmlCred delete_CkXml $xml delete_CkHttp $http |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.