1
votes

I am trying to make 'createAndSendEnvelope' request using DocuSign REST api/v2. My JSON is valid.

I came across the same question and I tried the solution given in there i.e. I made sure all new lines use '\r\n'.

What am I missing here? Here is my request, I get error code, "message": "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Envelope definition missing."

POST https://demo.docusign.net/restapi/v2/accounts/xxxxx/envelopes HTTP/1.1
X-DocuSign-Authentication: {"Username":"xxxxxx","Password":"xxxxx","IntegratorKey":"xxxxxx"}
Content-Type: multipart/form-data; boundary=AAA
Accept: application/json
Host: demo.docusign.net
Content-Length: 90500
Expect: 100-continue


--AAA
Content-Type: application/json
Content-Disposition: form-data
{
    "status": "sent",
    "recipients": {
        "signers": [{
            "tabs": {
                "signHeretabs": [{
                    "yPosition": "15",
                    "xPosition": "249",
                    "width": "100",
                    "tablabel": null,
                    "required": "TRUE",
                    "recipientId": "1",
                    "pagenumber": "1",
                    "fontSize": "Size12",
                    "font": "Calibri",
                    "documentid": "1",
                    "anchorYoffset": null,
                    "anchorXOffset": null,
                    "anchorUnits": "pixels",
                    "anchorString": "Sign Here",
                    "anchorIgnoreIfNotPresent": "true"
                }],
                "initialsTabs": [{
                    "yPosition": "45",
                    "xPosition": "249",
                    "width": "100",
                    "tablabel": null,
                    "required": "TRUE",
                    "receipientId": "1",
                    "pagenumber": "1",
                    "fontSize": "Size12",
                    "font": "Calibri",
                    "documentId": "1",
                    "anchorYoffset": null,
                    "anchorXOffset": null,
                    "anchorUnits": "pixels",
                    "anchorString": "Initials Here",
                    "anchorIgnoreIfNotPresent": "true"
                }],
                "dateSignedTabs": [{
                    "yPosition": "65",
                    "xPosition": "249",
                    "width": "100",
                    "tablabel": null,
                    "required": "TRUE",
                    "receipientid": "1",
                    "pagenumber": "1",
                    "fontSize": "Size12",
                    "font": "Calibri",
                    "documentid": "1",
                    "anchorYoffset": "-5",
                    "anchorXOffset": null,
                    "anchorUnits": "pixels",
                    "anchorString": "Date Signed",
                    "anchorIgnoreIfNotPresent": "true"
                }]
            },
            "routingorder": "1",
            "rolename": "roleNameHere",
            "recipientid": "1",
            "name": "XXXXXXXXXX",
            "email": "[email protected]"
        }]
    },
    "emailsubject": "TestDocuSign Call",
    "emailBlurb": "Test Email Blurb",
    "documents": [{
        "name": "Name1",
        "fileExtension": ".pdf",
        "documentId": "1",
        "documentBase64": null
    }]
}
--AAA
Content-Type: application/octet-stream
Content-Disposition: file; filename="Name1.pdf"; documentid="1"
Content-Transfer-Encoding: base64
VGhpcyBpcyBh
1

1 Answers

1
votes

You can specify your base64 encoded document bytes in the documentBase64 property

POST https://demo.docusign.net/restapi/v2/accounts/xxxxx/envelopes HTTP/1.1 X-DocuSign-Authentication: {"Username":"xxxxxx","Password":"xxxxx","IntegratorKey":"xxxxxx"}

Content-Type: application/json

{
 "status": "sent",
 "recipients": {
    "signers": [{
        "tabs": {
                <Removed tabs for brevity>
        },
        "routingorder": "1",
        "rolename": "roleNameHere",
        "recipientid": "1",
        "name": "XXXXXXXXXX",
        "email": "[email protected]"
    }]
 },
 "emailsubject": "TestDocuSign Call",
 "emailBlurb": "Test Email Blurb",
 "documents": [{
    "name": "Name1",
    "fileExtension": ".pdf",
    "documentId": "1",
    "documentBase64": "VGhpcyBpcyBh"
 }]
}