我正在使用Docusign API(通过ruby docusign_rest gem)并使用Postman重新编写此内容。
我有一个信封,其名称中有引号。当我尝试下载签名的PDF时,收到错误消息:
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."
}
当我列出文件时,它会显示带引号的信封的名称。
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...
}
}
我可以更改我的代码以防止新文档的引号,但我有现有的无法下载的签名文档。我该如何下载?或修理它们?
答案 0 :(得分:1)
您需要正确地转义json中的引号。
了解真实情况的唯一方法是查看api日志。
已添加
要查看api日志,您有两种选择:
答案 1 :(得分:1)
使用当前的docusign_rest版本(v0.3.1)我能够在文档的文件名中创建一个带引号的信封,然后下载该文档:
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: 'joe.dimaggio@example.org', 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"]
此外,最新版本supports call logging因此,如果需要,您可以在客户端提取日志。