Skip to content Skip to sidebar Skip to footer

Create Docusign Envelope With REST API Using Document Bytes: "cannot Convert"

I am following the API walkthrough for creating an envelopes here using Python: http://iodocs.docusign.com/APIWalkthrough/requestSignatureFromDocument The process works fine with a

Solution 1:

The solution was to send everything into bytes:

    def makeBody(file_stream, envelopeDef):
    reqBody = "\r\n\r\n--BOUNDARY\r\n" + \
            "Content-Type: application/json\r\n" + \
            "Content-Disposition: form-data\r\n" + \
            "\r\n" + \
            envelopeDef + "\r\n\r\n--BOUNDARY\r\n" + \
            "Content-Type: application/pdf\r\n" + \
            "Content-Disposition: file; filename=\"thesis.pdf\"; documentId=1\r\n" + \
            "\r\n"
    reqBody2 = "\r\n" + \
            "--BOUNDARY--\r\n\r\n"

    body = b"".join([bytes(reqBody, 'utf-8'), file_stream, bytes(reqBody2, 'utf-8')])
    return body

I'm sorely disappointed in Docusign support and their documentation for not showing in Python how to solve this. They only show the .txt file case. I have also emailed support and talked to them on Live Chat to make this clearer, but they have not responded.


Post a Comment for "Create Docusign Envelope With REST API Using Document Bytes: "cannot Convert""