I'm trying to use the Docusign API to create an envelope to get the sender view for an uploaded document, and then afterwards, get the recipient view.
The sender part worked fine. I created the request with all the information and I was able to send the document and open it in the console and add my signature tabs.
myResponse = getResponseBody(myRequest)
Dim uri As String = parseDataFromResponse(myResponse, "uri")
Dim envelopeId As String =
parseDataFromResponse(myResponse, "envelopeId")
url = baseURL + uri + "/views/sender"
Dim returnUrl As String = "http://whatever.com"
xmlBody =
"<returnUrlRequest xmlns=""http://www.docusign.com/restapi"">
<returnUrl>" & returnUrl & "</returnUrl></returnUrlRequest>"
myRequest = initializeRequest(url, "POST", xmlBody, username, password,
integratorKey)
myResponse = getResponseBody(myRequest)
Session("senderViewUrl") = parseDataFromResponse(myResponse, "url")
It worked fine. I redirected the browser to the senderViewURL
and it created the envelope. The next few lines of code I want to be able to get the returnUrl from the recipient view so I can embed it into an iframe on my site for another user but I'm getting a 400 BAD REQUEST. Everything looks fine to me. I tried it with and without the "authenticationInstant" tag.
url = baseURL + uri + "/views/recipient"
Dim requestBody As String = "<recipientViewRequest
xmlns=""http://www.docusign.com/restapi"">" &
"<authenticationMethod>email</authenticationMethod>" &
"<email>" & recipientEmail & "</email>" &
"<returnUrl>http://whatever2.com</returnUrl>" &
"<clientUserId>" & clientId & "</clientUserId>" &
"<userName>" & recipientName & "</userName>" &
"</recipientViewRequest>"
myRequest = initializeRequest(url, "POST", requestBody, username,
password, integratorKey)
myResponse = getResponseBody(myRequest)
Session("recipientViewUrl") = parseDataFromResponse(myResponse, "url")
Both url's use use the same envelope ID. Do I need a completely separate envelope for the recipient view request?
If so, is there ANY WAY to get the URL of the recipient view after I create the sender view request. I need a returnURL for the sender view so when the user finishes it.. my application marks the document in my own DB as having gone out. I need to be able to have a returnURL for the recipientview as well so once it's signed I can have my application record that it's been signed.
Added
And yes the clientUserId is defined when the envelope is first created. The Embedded Sending page is missing something.
It says for Step 3 do this: "Get DocuSign Sender View" and then receives recipient view URL.... but NOWHERE in the code examples does it actually show how/where to get that recipient view URL. It only shows you have to get the SENDER VIEW URL so you can tag and send, but this is misleading.... you're not actually getting the recipient view URL.
Also, in the last request to get the recipient view I change the recipientViewRequest to returnUrlRequest... still nothing... 400 bad request.
Here is the original xml body when the envelope was created:
"<envelopeDefinition xmlns=""docusign.com/restapi"">"; &
"<emailSubject>Test</emailSubject>" &
"<status>created</status>" &
"<documents>" &
"<document>" &
"<documentId>1</documentId>" &
"<name>" & documentName & "</name>" &
"</document>" &
"</documents>" &
"<recipients>" &
"<signers>" &
"<signer>" &
"<recipientId>1</recipientId>" &
"<clientUserId>" & clientId & "</clientUserId>" &
"<email>" & recipientEmail & "</email>" &
"<name>" & recipientName & "</name>" &
"<tabs>" &
"<signHereTabs>" &
"<signHere>" &
"<documentId>1</documentId>" &
"<pageNumber>1</pageNumber>" &
"</signHere>" &
"</signHereTabs>" &
"<dateSignedTabs>" &
"<dateSigned>" &
"<documentId>1</documentId>" &
"<pageNumber>1</pageNumber>" &
"<fontSize>Size12</fontSize>" &
"<underline>true</underline>" &
"<bold>true</bold>" &
"</dateSigned>" &
"</dateSignedTabs>" &
"</tabs>" &
"</signer>" &
"</signers>" &
"</recipients>" &
"</envelopeDefinition>"
I changed the to "sent" and it still didn't work. 400 Bad Request – Brian Lorraine 23 hours ago
Another weird thing. Notice how under "documents" and "signers" I have "document" and "signer" child elements. Everyone out there I see with examples leaves out the child elements and puts their signer and document information directly under "documents" and "signers" and it seems to work fine for them.
Once I remove "document" and "signer" child elemnts and just have (for e.g.) "", skipping the "document" element completely, docusign throws a 400 Bad request. What give? Why is everyone else able to skip these child nodes except for me?