We are using docusign
for people to sign consent forms that register on our web site and I was pointed to the Embedded Signing API.
From what I understood, I had to create an envelope which I have done.
I am using the .Net examples for this.
Login through the API fine, but I get the following error trying to get the URL back from the API:
ENVELOPE_IS_INCOMPLETE The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line.
Here is my envelopeDefinition xml:
string requestBody = "<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<accountId>" + accountId + "</accountId>" +
"<status>sent</status>" +
"<emailSubject>API Call for Embedded Sending</emailSubject>" +
"<emailBlurb>This comes from C#</emailBlurb>" +
"<templateId>[TEMPLATE ID FROM DOCUSIGN]</templateId>" +
"<templateRoles>" +
"<email>testregister@notrealurl.com</email>" + // NOTE: Use different email address if username provided in non-email format!
"<name>testregister@notrealurl.com</name>" + // username can be in email format or an actual ID string
"<roleName>Signer</roleName>" +
"</templateRoles>" +
"</envelopeDefinition>";
I saw another posting about needing a clientUserId here:
http://community.docusign.com/t5/DocuSign-API-Integration-NET/REST-API-net-Error-message-when-creating-the-envelope-from-a/m-p/18121#M1791
But I am not sure how to implement in the envelopeDefinition.
Please help!
To use Embedding functionality you do indeed need to set the clientUserId property for each recipient who will access the envelope using a URL token. The trick is that when you create the envelope you need to set the clientUserId property for the recipient, then when you are requesting the URL token you need to include it in the request, along with their email, name, and recipientId.
DocuSign's Developer Center has a whole page dedicated to Embedding, and it discusses the use of the clientUserId property. Please see here:
http://www.docusign.com/developer-center/explore/features/embedding-docusign
Their API Walkthroughs are also a great resource. They have code in 6 languages showing you how to accomplish common DocuSign tasks. Look at the bottom three for Embedding functionality:
http://iodocs.docusign.com/APIWalkthroughs
[Update]
Ok, I was able to reproduce your issue and have updated the gist that you were working off of. It should work now if you copy as is and enter your credentials, but basically there were two parts missing from the request body. Here is what it should look like, note the extra templateRole (singular) tag and the clientUserId tag:
string requestBody = "<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<accountId>" + accountId + "</accountId>" +
"<status>sent</status>" +
"<emailSubject>API Call for Embedded Sending</emailSubject>" +
"<emailBlurb>This comes from C#</emailBlurb>" +
"<templateId>" + templateId + "</templateId>" +
"<templateRoles>" +
"<templateRole>" +
"<email>" + username + "</email>" + // NOTE: Use different email address if username provided in non-email format!
"<name>Name</name>" + // username can be in email format or an actual ID string
"<roleName>" + roleName + "</roleName>" +
"<clientUserId>1</clientUserId>" +
"</templateRole>" +
"</templateRoles>" +
"</envelopeDefinition>";