I'm new to REST API and DocuSign. I'm trying to upload a document on which I would like to apply the web template that I created in my account.
Here's the code I have so far (I'm referring to the following code https://gist.github.com/Ergin008/4165742) but it doesn't show how to attach new PDF document with my request and apply existing template to the new pdf while making API call. Any sample code or help would be greatly appreciated. Thanks.
HttpWebRequest request = initializeRequest("https://demo.docusign.net/restapi/v2/login_information", "GET", null, username, password, integratorKey); string response = getResponseBody(request); baseURL = parseDataFromResponse(response, "baseUrl"); Console.WriteLine("\nAPI Call Result: \n\n" + prettyPrintXml(response)); // Request Signature using Template url = baseURL + "/envelopes"; string requestBody = "<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" + "<status>sent</status>" + "<emailSubject>DocuSign API - Signature Request from Template</emailSubject>" + "<documents>" + "<document>" + "<documentId>1</documentId>" + "<name>Testdoc.pdf</name>" + //"<PDFBytes>" + Convert.ToBase64String(fileBytes) + "</PDFBytes>" + "</document>" + "</documents>" + "<templateId>" + templateId + "</templateId>" + "<templateRoles>" + "<templateRole>" + "<name>" + recipientName + "</name>" + "<email>" + recipientEmail + "</email>" + "<roleName>" + templateRole + "</roleName>" + "</templateRole>" + "</templateRoles>" + "</envelopeDefinition>"; request = initializeRequest(url, "POST", requestBody, username, password, integratorKey); // request.ContentType = "application/pdf"; response = getResponseBody(request); Console.WriteLine("\nAPI Call Result: \n\n" + prettyPrintXml(response));
No comments:
Post a Comment