DocuSign REST API - Retrieve partially signed document - docusignapi

I'm using REST API for Embedded Signing. I need to obtain the signed document when the first signer (of N) signed. When creating the envelope, I'm sending the recipientEvents array as follows:
"recipientEvents": [
{
"includeDocuments": "true",
"recipientEventStatusCode": "completed"
}
]
In my endpoint I'm receiving a base encoded document in the XML response (see below) for the RecipientStatus with status completed. However this is not the document signed by the first signee but the original one sent along with the create envelope json. How can I receive the signed document from DS?
<DocumentPDFs>
<DocumentPDF>
<Name>Test2.pdf</Name>
<PDFBytes>JVBERi0xLjQKJfv8/f4KJVdyaXRpbmcgb2JqZWN0cy4uLgoxNCAwIG9i ---</PDFBytes>
<DocumentID>1</DocumentID>
<DocumentType>CONTENT</DocumentType>
</DocumentPDF>
</DocumentPDFs>

You will have to make a REST API call for the document from you server in this case because it's a recipient event and the entire envelope is not complete yet. This is what it looks like:
GET https://demo.docusign.net/restapi/v2.1/accounts/{ACCOUNT_ID}/envelopes/{ENVELOPE_ID}/documents/{DOCUMENT_ID}

Related

DocuSign ID Check with Embedded signing for documents sent via JAVA SDK

I'm trying to achieve ID Check on embedded signing through an envelope sent via Docusign Java SDK. I am able to make it work through remote signing however, I get the following error on embedded signing.
{
"errorCode": "INVALID_REQUEST_PARAMETER",
"message": "The request contained at least one invalid parameter. The value of AuthenticationMethod is invalid."
}
I'm fully aware of another post on the same topic posted in 2013 (DocuSign ID Check with Embedded signing). The difference here is that I'm not using any document templates but sending the documents in the envelope itself. Based on the comments a bug was logged with bug id 30830 but I can't say whether this was resolved.
Also, I have already added the settings that I know that are required for ID Check.
signer.setRequireIdLookup("true");
recipientViewRequest.setAuthenticationMethod("ID Check $");
Can anyone advise on what I'm missing ?
It's a little hard to tell from your question but from what I gather you might be setting the properties on the wrong request. As you know when creating a remote signing request you can do it through just one API request - Envelopes: create.
For embedded signing you still first create an envelope (with an embedded recipient) but then you need to generate the signing URL by calling EnvelopeViews: createRecipient.
When setting the ID Check authentication for your recipient you still need to assign this in the first request (ie the create envelope call) so that recipient is configured like so:
"recipients": {
"signers": [
{
"idCheckConfigurationName": "ID Check $",
"requireIdLookup": "true",
...
}
]
}
THEN, in the request body of the second call you need to set the authenticationMethod with the same value and provide the other required params to identify the signer.
Please confirm you are following this flow and if so and still stumped then post the actual JSON that you are sending for your requests and we should be able to determine from there.

How to download Signed Document from an Envelope?

Once a user signs a document attached to an envelope, is there anyway that developer can download that document using Rest API end-point? And before downloading it, is there any way to tell whether the document is signed or not?
Part I: Determine whether a particular signer OR whether all recipients have completed/submitted an Envelope
To check whether a particular Signer (recipient) has completed signing an Envelope, you can use the List Envelope Recipients request:
GET /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients
As shown here, the signers property within the JSON response is the array of signers for the Envelope, and the status property within each signer object indicates that particular recipient's status. A status of completed for a signer indicates that the recipient has signed/completed/submitted the Envelope.
{
...
"signers": [
{
"deliveredDateTime": "2016-10-05T21:18:12.3330000Z",
"email": "jallard#example.com",
"isBulkRecipient": "false",
"name": "Jennie Allard",
"recipientId": "1",
"recipientIdGuid": "4575d5e9-7654-467b-b2f5-6c59ca7c43f8",
"requireIdLookup": "false",
"routingOrder": "1",
"signedDateTime": "2016-10-05T21:18:41.6930000Z",
"status": "completed",
"userId": "ca45284a-a94e-4ee2-90af-76035bd795b2"
}
]
}
Alternatively, to check whether ALL recipients of an Envelope have completed/submitted the Envelope, you can use the Get Envelope request:
GET /v2/accounts/{accountId}/envelopes/{envelopeId}
As shown here, the response will be an Envelope object and the status property within that object indicates the overall status of the Envelope. A status of completed indicates that all recipients have completed/submitted the Envelope.
Part II: Download completed document(s)
For endpoints related to retrieving document(s) for an Envelope, see this page: https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeDocuments/. You'll likely use the List Envelope Documents request to get the list of documents in the Envelope, and then subsequently issue a Get Envelope Document request for each document that you want to retrieve.
Additional comments
While you certainly can use REST API requests as I've described above to periodically poll for Envelope (or Recipient) status, and then request document(s) when envelope (and/or recipient) status is completed -- a more efficient alternative would be to use DocuSign Connect, which you could configure to automatically push Envelope status and documents to an endpoint you specify when an Envelope reaches status = completed.

Docusign EnvelopeSummary return custom fields

This is with the REST api and the GitHub C# client. I create an envelope and send it off using the CreateEnvelope call. I see the deserialize calls JsonConvert.DeserializeObject on the content using the EnvelopeSummary model and it works as expected. Can EnvelopeSummary return what it does now, but also custom fields if I supplied them. I can make an additional call with the envelopeid to get this info. I would like to avoid that.
You will have to make a separate API call to retrieve the envelope custom fields.
(listCustomFields)
As per the API documentation, CreateEnvelope returns the envelopeSummary object which contains the following four properties
envelopeId
status
statusDateTime
uri
Here is a sample response.
{
"envelopeId": "91d26c0d-2e5f-40d9-bf5e-de19539d5ebf",
"uri": "/envelopes/91d26c0d-2e5f-40d9-bf5e-de19539d5ebf",
"statusDateTime": "2017-01-24T18:33:06.8230000Z",
"status": "sent"
}
Use the Connect publishing service. Implement a "Connect Listener" (a Web application) and register to receive push envelope status messages, which include the envelope custom fields.
Using Connect is considered a "best practice" and does not use any API calls (does not impact your quota, does not require an API Certification). Go to the DocuSign Dev Center and look for info on Connect or "Webhooks".

Embedded Docusign Signing URL - using document visibility to only show 1 document in the envelope

I am creating an envelope via the Docusign Rest API. this envelope has 2 inline templates each have their own roles and do not share any tabs. I have a custom workflow that requires the user to fill in each document separately so i use the (/views/reciepients) endpoint to get a signing url.
The first signer sees the first (and only the first) document correctly, it is filled in and completed. Then i want to show the second document from the envelope in an iframe to a user. When i get the signing URL for the second recipient (signer) it also includes the first document all filled out.
I have document visibility set up on the account.
I have read the documentation a few times and there is one confusing, under "Post Recipient View" there is a field "userName" which is not mentioned when creating the recipient or in the response from the recipient end point. I assume this is the "name" field.
to make it a bit easier to read i have put all the API requests into paste bin.
Generate Envelope with 2 templates and 2 signers.
Request = http://pastebin.com/e98Dwaj8
Get First signing URL using /envelope/xxxx/views/recipient
Request =
{
"returnUrl": "http:\/\/local.example.com\/return.html",
"authenticationMethod": "none",
"email": "role1#example.com",
"userName": "TestFirstName TestSurname",
"clientUserId": "1"
}
Get recipients for envelope after first signer has completed
Response = http://pastebin.com/9VmGsE3p
Get second signing url (this shows both documents when visited)
Request =
{
"returnUrl": "http:\/\/local.example.com\/return.html",
"authenticationMethod": "none",
"email": "test#example.com",
"userName": "TestFirstName TestSurname1",
"clientUserId": "2"
}
Is there a way i can show the second signer only the second document?
Is it possible or will the completed document always show? does the /views/recipient url only hide documents in "draft" or "sent" and always shows "completed"?
note: this is a follow up to Docusign signing url - Showing document 1 of a composite template but that question was answered and solved the original issue so i thought it best to open a new more specific question.
In order for certain signers to only see certain documents, you will want to investigate the Document Visibility feature and settings. There is some starting documentation available at: https://support.docusign.com/guides/cdse-user-guide-advanced-sending-using-document-visibility-in-a-template
In short, signers can only see documents in an envelope for which they have at least 1 tab assigned. This is honored during the signing ceremony as well as any view of the completed document.
Regarding your last question, you should only be able to start a POST /recipient/view (signing ceremony) for an envelope which has been SENT. If you perform this action against an envelope which is completed it will start the signing session in a read only viewing mode (since the transaction is complete).
Is the 2nd signer a member on the sending account? If so, they would be able to see all documents in the envelope based on "Must sign to view unless Sender Account". This setting essentially means internal signers that have memberships on the same account as the Sender can see everything.

Docusign Powerforms Embed Success Status

I'm working on a PHP application that has multiple products which require signing from a customer before going for the product.
I'm using powerforms link to embed them on my application (using iFrame).
They work fine. But the problem is I need to store the document signed status in my database.
The we can set a return URL in the Docusign Preferences Page. But that will be static and I won't have a clue of what product the user has selected.
References:
Powerform Docs
You can use DocuSign Connect to receive real-time notifications of envelope events (for example, Envelope Completed). At a high-level, it works like this:
You login to DocuSign web console (as Admin) and create a Custom Connect Configuration. As part of creating this configuration, you'll specify the endpoint (http address) that you want Connect to send notifications to, and which events you want to be notified of.
You build a "listener" -- i.e., the web page that will receive the HTTP POST messages from DocuSign Connect, and process those messages.
When an Envelope or Recipient event occurs (for which you've enabled notifications in your DocuSign Connect Configuration), Connect will almost immediately send an HTTP POST to your listener. This message contains XML with info about the Envelope, Recipients, Documents, Fields, etc. You'll develop your listener such that it parses the XML message to determine Envelope status, data field values, etc. and then can respond appropriately within the context of your application (i.e., in your scenario, your listener would use the XML message from Connect to determine envelope status and which product(s) the user selected).
See this guide (http://www.docusign.com/sites/default/files/DocuSign_Connect_Service_Guide.pdf) and this page in the DocuSign Dev Center (http://www.docusign.com/developer-center/explore/connect) for more detailed information on configuring/using DocuSign Connect.
UPDATE - Using Custom Fields to populate unique Identifier for Envelope
Depending on the nature of your use case, you might need to use an "envelope custom field" to populate a unique identifier for each Envelope in the "create/send envelope" request, so that your listener application has a way of identifying the envelope when it receives a Connect message. (An 'envelope custom field' is simply a custom piece of metadata on an envelope.) Simply set the customFields property in your Create Envelope request, and populate a single textCustomFields item with the unique identifier. For example:
{
"emailSubject": "Please sign this",
"emailBlurb": "Please sign...thanks!",
"customFields": {
"textCustomFields": [
{
"value": "1234567",
"required": "false",
"show": "true",
"name": "ProductId"
}
]
},
"status": "sent"
...
}
See the REST API Guide (http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf) for more detailed info about using Custom Envelope Fields.

Resources