A. Branch
A. Branch

Reputation: 63

DocuSign API: upload NetSuite document to envelope

I'm building a dynamic PDF in NetSuite. I want to upload it to a new DocuSign envelope using the DocuSign REST API. I've seen a lot of answers, but I'm missing something. I'm finding myself running around in circles in the API and online.

In the DocuSign REST API for [creating Envelopes][1] it details how to add a document to an envelope, specifically using the documents node:

"documents": [{
    "documentId": "1",
    "name": "contract.pdf",
    "documentBase64": "base64 document bytes...",
}],

Is the "name" property the filepath where the document is located in my NetSuite directory? Is it instead expecting the file to already be in the DocuSign document folder? Needing to encode implies the former. Using only a filename implies the latter.

Thank you.

Upvotes: 1

Views: 362

Answers (1)

Kim Brandl
Kim Brandl

Reputation: 13480

When you set the name property within a document object in a Create Envelope request, you're specifying the name of the document as it'll appear within the Envelope. For example, the name of the document in the following screenshot is dstest.txt (as shown above the document thumbnail in the right pane).

DS Envelope

You should set the documentBase64 property to the the base64-encoded string that represents the content of the file. That is, you'll do the following in your code:

  • Read in the file from where ever it's stored.
  • Create a string that represents the base64-encoded content of the file.
  • Set the documentBase64 property within the document object in the Create Envelope request to the base64-encoded string that represents the content of the file.

Upvotes: 2

Related Questions