0
votes

I'm using the Docusign API (via the ruby docusign_rest gem) and repro'd this using Postman.

I have an envelope whose name has quotes in it. When I tried to download the signed PDF, I get an error message:

https://www.docusign.net/restapi/v2/accounts/{account_id}/envelopes/{envelope_id}/documents/1

{
  "errorCode": "UNSPECIFIED_ERROR",
  "message": "The format of value 'file; filename=\"My filename (\"MF\") has quotes.pdf\"; documentid=\"1\"' is invalid."
}

When I list the documents, it shows the name of the envelope having quotes.

https://www.docusign.net/restapi/v2/accounts/{account_id}/envelopes/{envelope_id}/documents

{
  "envelopeId": "{envelope_id}",
  "envelopeDocuments": [
    {
      "documentId": "1",
      "name": "My filename (\"MF\") has quotes.pdf",
      "type": "content",
      "uri": "/envelopes/{envelop_id}/documents/1",
etc...
    }
}

I can change my code to prevent quotes for new documents, but I have existing signed documents that I can't download. How can I download them? Or fix them?

2
I updated my answer. - Larry K

2 Answers

1
votes

You will need to properly escape the quotes in your json.

The only way to know what is really happening is to see the api logs.

Added

To see the api logs, you have two choices:

  1. See the instructions
  2. Use the API Logging Feature of the new (still beta) Recipe tool. has a more convenient interface to the API Logger.
1
votes

Using the current docusign_rest release (v0.3.1) I was able to create an envelope with a quote in the document's filename and then download that document:

client = DocusignRest::Client.new
res = client.create_envelope_from_document(email: {subject: "test email subject",body: "this is the email body and it's large!"}, signers: [{embedded: true, name: 'Joe Dimaggio', email: '[email protected]', role_name: 'Issuer',sign_here_tabs: [{anchor_string: 'sign here',anchor_x_offset: '-30',anchor_y_offset: '35'}]},], files: [{path: '/Users/tomcopeland/github.com/docusign_rest/test".pdf', name: 'test".pdf'},],status: 'sent')
client.get_document_from_envelope(envelope_id: res['envelopeId'], document_id: "1", local_save_path: "/tmp/foobar.pdf")
client.get_documents_from_envelope(envelope_id: res['envelopeId'])["envelopeDocuments"].map {|d| d["name"] }
=> ["test\".pdf", "Summary"]

Also, this latest release supports call logging so, if needed, you can extract logs client-side.