0
votes

Facing Issue while sending document for signature using below DocuSign REST API for docx and doc with image, working fine for pdf and doc without image

Working when using base64 for all of above formats https://demo.docusign.net/restapi/v2/accounts/{accountId}/envelopes

Below is sample Request

--MY_BOUNDARY
Content-Type: application/json
Content-Disposition: form-data

{
"status" : "sent",
"emailSubject" : "Test Envelope Subject",
"emailBlurb" : "Test Envelope Blurb",
"compositeTemplates": [
{

    "inlineTemplates": [
    {
        "sequence" : 2,
        "recipients": {
            "signers" : [{
                "email": "[email protected]",
                "name": "abc",
                "recipientId": "123",
                "roleName": "Initiator",
                "routingOrder":"123"
            }
            ]
        }
    }]
},
{
    "inlineTemplates": [
    {
        "sequence" : 1,
        "recipients": {
            "signers" : [{
                "email": "[email protected]",
                "name": "abc",
                "recipientId": "1"
            }]
        }
    }],
    "document": {
        "documentId": 1343,
        "name": "Sample1",
        "fileExtension": "docx"
    }
}
]}
--MY_BOUNDARY
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Disposition: file; filename="Sample1.docx"; documentid="1343"

Content

--MY_BOUNDARY--
1
Maybe try using mime type application/msword even for docx? I think the platform relies more on the fileExtension field rather than the mime type but I could be wrong. - Larry K

1 Answers

0
votes

Try adding an extra CRLF before your second boundary like this:

]}

--MY_BOUNDARY
Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Content-Disposition: file; filename="Sample1.docx"; documentid="1343"