Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Objective-C Examples

Web API Categories

ASN.1
AWS KMS
AWS Misc
Amazon EC2
Amazon Glacier
Amazon S3
Amazon S3 (new)
Amazon SES
Amazon SNS
Amazon SQS
Async
Azure Cloud Storage
Azure Key Vault
Azure Service Bus
Azure Table Service
Base64
Bounced Email
Box
CAdES
CSR
CSV
Certificates
Cloud Signature CSC
Code Signing
Compression
DKIM / DomainKey
DNS
DSA
Diffie-Hellman
Digital Signatures
Dropbox
Dynamics CRM
EBICS
ECC
Ed25519
Email Object
Encryption
FTP
FileAccess
Firebase
GMail REST API
GMail SMTP/IMAP/POP
Geolocation
Google APIs
Google Calendar
Google Cloud SQL
Google Cloud Storage
Google Drive
Google Photos
Google Sheets
Google Tasks
Gzip
HTML-to-XML/Text
HTTP

HTTP Misc
IMAP
JSON
JSON Web Encryption (JWE)
JSON Web Signatures (JWS)
JSON Web Token (JWT)
Java KeyStore (JKS)
MHT / HTML Email
MIME
MS Storage Providers
Microsoft Graph
Misc
NTLM
OAuth1
OAuth2
OIDC
Office365
OneDrive
OpenSSL
Outlook
Outlook Calendar
Outlook Contact
PDF Signatures
PEM
PFX/P12
PKCS11
POP3
PRNG
REST
REST Misc
RSA
SCP
SCard
SFTP
SMTP
SSH
SSH Key
SSH Tunnel
ScMinidriver
SharePoint
SharePoint Online
Signing in the Cloud
Socket/SSL/TLS
Spider
Stream
Tar Archive
ULID/UUID
Upload
WebSocket
XAdES
XML
XML Digital Signatures
XMP
Zip
curl
uncategorized

 

 

 

(Objective-C) Send DocuSign XML Request

Demonstrates how to send a DocuSign XML request.

Important:This example requires Chillkat v9.5.0.75 or greater.

Chilkat Objective-C Library Downloads

MAC OS X (Cocoa) Libs

iOS Libs

#import <CkoHttpRequest.h>
#import <CkoXml.h>
#import <CkoHttp.h>
#import <CkoHttpResponse.h>
#import <NSString.h>

// This requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

CkoHttpRequest *req = [[CkoHttpRequest alloc] init];

req.HttpVerb = @"POST";

// Replace "12999999" with your own account number. (12999999 is a ficticious account number)
req.Path = @"/restapi/v2/accounts/12999999/envelopes";

[req AddHeader: @"Accept" value: @"application/xml"];

// Don't worry about the boundary string.  Chilkat will automatically generate one and include it.
req.ContentType = @"multipart/form-data";

CkoXml *xmlCred = [[CkoXml alloc] init];
xmlCred.Tag = @"DocuSignCredentials";
[xmlCred UpdateChildContent: @"Username" value: @"YOUR_DOCUSIGN_USERNAME"];
[xmlCred UpdateChildContent: @"Password" value: @"YOUR_DOCUSIGN_PASSWORD"];
[xmlCred UpdateChildContent: @"IntegratorKey" value: @"ABCD-12345678-1234-AAAA-BBBB-abcdabcdabcd"];
xmlCred.EmitXmlDecl = NO;
xmlCred.EmitCompact = YES;
[req AddHeader: @"X-DocuSign-Authentication" value: [xmlCred GetXml]];

// Don't worry about Host or Content-Length headers, Chilkat automatically adds them...

// Build the XML for the 1st body part..
CkoXml *xml = [[CkoXml alloc] init];
xml.Tag = @"envelopeDefinition";
[xml AddAttribute: @"xmlns" value: @"http://www.docusign.com/restapi"];
[xml UpdateChildContent: @"emailSubject" value: @"Signature Request: Test Test:001019:033611"];
[xml UpdateChildContent: @"status" value: @"sent"];
[xml UpdateChildContent: @"documents|document|documentId" value: @"1"];
[xml UpdateChildContent: @"documents|document|name" value: @"001019_TestTest_RetailDeals_163357"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|hostEmail" value: @"admin@chilkatsoft.com"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|hostName" value: @"Chilkat Admin"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|signerName" value: @"Test  Test"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|recipientId" value: @"1"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|routingOrder" value: @"1"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|signerEmail" value: @"test@tyest.com"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|anchorString" value: @"\\SDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere|optional" value: @"False"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|anchorString" value: @"\\OSDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[1]|optional" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|anchorString" value: @"\\OPSSDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|optional" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[2]|scaleValue" value: @"0.7"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|anchorString" value: @"\\PSSDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|optional" value: @"False"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|signHereTabs|signHere[3]|scaleValue" value: @"0.7"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|anchorString" value: @"\\IDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere|optional" value: @"False"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|anchorString" value: @"\\OIDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[1]|optional" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|anchorString" value: @"\\OPSIDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|optional" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[2]|scaleValue" value: @"0.5"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|anchorString" value: @"\\PSIDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|optional" value: @"False"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner|tabs|initialHereTabs|initialHere[3]|scaleValue" value: @"0.5"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|hostEmail" value: @"admin@chilkatsoft.com"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|hostName" value: @"Chilkat Admin"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|signerName" value: @"Dealer Representative"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|recipientId" value: @"2"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|routingOrder" value: @"2"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|anchorString" value: @"\\DSDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere|optional" value: @"False"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|anchorString" value: @"\\DOSDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|signHereTabs|signHere[1]|optional" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|anchorString" value: @"\\DIDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere|optional" value: @"False"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|anchorIgnoreIfNotPresent" value: @"True"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|anchorString" value: @"\\DOIDP"];
[xml UpdateChildContent: @"recipients|inPersonSigners|inPersonSigner[1]|tabs|initialHereTabs|initialHere[1]|optional" value: @"True"];
xml.EmitXmlDecl = NO;

NSLog(@"%@",[xml GetXml]);

xml.EmitCompact = YES;

// IMPORTANT: This example requires Chilkat v9.5.0.75 or greater.
[req AddStringForUpload2: @"" filename: @"" strData: [xml GetXml] charset: @"utf-8" contentType: @"application/xml"];
[req AddFileForUpload2: @"" path: @"qa_data/pdf/signatureForm.pdf" contentType: @"application/pdf"];
[req AddSubHeader: [NSNumber numberWithInt: 1] name: @"Content-Disposition" value: @"file; filename=\"signatureForm.pdf\";documentid=1"];

CkoHttp *http = [[CkoHttp alloc] init];

http.SessionLogFilename = @"qa_output/log.txt";

CkoHttpResponse *resp = [http SynchronousRequest: @"na2.docusign.net" port: [NSNumber numberWithInt: 443] ssl: YES req: req];
if (http.LastMethodSuccess != YES) {
    NSLog(@"%@",http.LastErrorText);
    return;
}

if ([resp.StatusCode intValue] != 201) {
    NSLog(@"%@",resp.BodyStr);
    NSLog(@"%@%d",@"Response status code: ",[resp.StatusCode intValue]);
    NSLog(@"%@",@"Failed.");

    return;
}

// Examine the response..
[xml LoadXml: resp.BodyStr];
NSString *envelopeId = [xml GetChildContent: @"envelopeId"];
NSLog(@"%@%@",@"envelopeId = ",envelopeId);
NSString *status = [xml GetChildContent: @"status"];
NSLog(@"%@%@",@"status = ",status);
NSString *statusDateTime = [xml GetChildContent: @"statusDateTime"];
NSLog(@"%@%@",@"statusDateTime = ",statusDateTime);
NSString *uri = [xml GetChildContent: @"uri"];
NSLog(@"%@%@",@"uri = ",uri);
 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.