I am trying to pass the address and social security information that is collected from an employee into DocuSign templates I have created. I can easily send a form using the code below and have tried adding the element to pass values but this isn't working or throwing errors.
// STEP 1 - Login API Call (used to retrieve your baseUrl)
// Endpoint for Login api call (in demo environment):
string url = "https://demo.docusign.net/restapi/v2/login_information";
// set request url, method, and headers. No body needed for login api call
HttpWebRequest request = initializeRequest( url, "GET", null, username, password, integratorKey);
// read the http response
string response = getResponseBody(request);
// parse baseUrl value from response body
baseURL = parseDataFromResponse(response, "baseUrl");
//--- display results
Console.WriteLine("\nAPI Call Result: \n\n" + prettyPrintXml(response));
// STEP 2 - Send Signature Request from Template
// append "/envelopes" to baseURL and use for signature request api call
url = baseURL + "/envelopes";
// construct an outgoing XML formatted request body (JSON also accepted)
string requestBody =
"<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<status>sent</status>" +
"<emailSubject>DocuSign API - Signature Request from Template</emailSubject>" +
"<templateId>" + templateId + "</templateId>" +
"<textTabs>" +
"<tabLabel>street</tabLabel>" +
"<value>" + streetAddress + "</value>" +
"<documentId>1</documentId>" +
"<pageNumber>1</pageNumber>" +
"</textTabs>" +
"<templateRoles>" +
"<templateRole>" +
"<name>" + recipientName + "</name>" +
"<email>" + recipientEmail + "</email>" +
"<roleName>" + templateRole + "</roleName>" +
"</templateRole>" +
"</templateRoles>" +
"</envelopeDefinition>";
// set request url, method, body, and headers
request = initializeRequest( url, "POST", requestBody, username, password, integratorKey);
// read the http response
response = getResponseBody(request);
//--- display results
Console.WriteLine("\nAPI Call Result: \n\n" + prettyPrintXml(response));
My templates already have all of the fields added with custom labels for the fields I would like to populate programmatically. I just can't figure out how to format the request body correctly to get these fields to be set.