Tuan
Tuan

Reputation: 19

DocuSign C# REST API Attaching documents with signers to existing envelope

Ones I create a draft envelope with two signers attach to a pdf document. Then try to attach second documents with one signer to the same envelope. The document gets attached but signer is not added to envelop. Please let me know what am I missing here.

Attach document for same envelop code

HttpWeb Request URL

 url = "https://demo.docusign.net/restapi/v2/accounts/" + accountID + "/envelopes/" + envelopID + "/documents"; 

Rest Script

strAttDOCScript = "{ \"status\": \"sent\", \"documents\": [{ \"documentId\": \"" + iDocumentID +"\", \"name\": \"" + strDocumentName +"\", \"documentBase64\": \"" + System.Convert.ToBase64String(AttFile) +"\" }]," +
                "\"recipients\": { \"signers\": [{ \"email\": \"[email protected]\", \"name\": \"Sara Mason\", \"recipientId\": \"3\", \"tabs\": { \"checkboxTabs\": [{ \"tabLabel\": \"sampleCheckbox\", \"xPosition\": \"20\", \"yPosition\": \"20\"," +
                 "\"documentId\": \"2\", \"pageNumber\": \"1\" }], \"signHereTabs\": [{ \"conditionalParentLabel\": \"sampleCheckbox\", \"conditionalParentValue\": \"On\", \"xPosition\": \"80\", \"yPosition\": \"40\", \"documentId\": \"2\", \"pageNumber\": \"1\" }] } }] }}";

Upvotes: 0

Views: 461

Answers (2)

Amit K Bist
Amit K Bist

Reputation: 6808

Using EnvelopeDocument:Update, you will add second document in the draft envelope. Once you have added the document in the envelope then you need to call EnvelopeUpdates with query parameter advanced_update=true

URI:

PUT /restapi/v2/accounts/{accountId}/envelopes/{envelopeId}?advanced_update=true

Body:

recipientId value should be the recipientId of the signer whose tabs needed to be added to second document.

{
    "status":"sent",
    "recipients": {
      "signers": [
                     {
                        "recipientId": "1",
                        "tabs": {
                            "checkboxTabs": [{
                                "tabLabel": "sampleCheckbox",
                                "xPosition": "20",
                                "yPosition": "20",
                                "documentId": "2",
                                "pageNumber": "1"
                            }],
                            "signHereTabs": [{
                                "conditionalParentLabel": "sampleCheckbox",
                                "conditionalParentValue": "On",
                                "xPosition": "80",
                                "yPosition": "40",
                                "documentId": "2",
                                "pageNumber": "1"
                            }]
                        }
                    }
        ]
    }
}

Upvotes: 2

Ergin
Ergin

Reputation: 9356

Once you create a draft envelope to add more documents to it you need to call EnvelopeDocuments: update API. Note that this is a PUT method, not a POST like you did when creating the envelope.

If this does not solve your issue then please post the full details of your API request such as endpoint, verb, request body, and exact response so we can inspect (you can redact any private info if needed).

Upvotes: 0

Related Questions