你如何更新docusign信封文件?

时间:2016-05-25 19:47:29

标签: java docusignapi

在下面的java中,我创建了一个包含文档的信封,然后尝试更新文档。创建工作正常,但我在更新时收到文件转换错误。我正在使用docusign java客户端。有什么想法吗?

    // create
    List<Document> documents = new ArrayList<>();
    Document document = newDocument("1", "title", file);
    documents.add(document);

    EnvelopeDefinition envelopeDefinition = new EnvelopeDefinition();
    envelopeDefinition.setDocuments(documents);
    envelopeDefinition.setStatus("created");
    EnvelopesApi envelopesApi = new EnvelopesApi();
    EnvelopeSummary envelopeSummary = envelopesApi.createEnvelope(accountId, envelopeDefinition);

    // update
    documents = new ArrayList<>();
    document = newDocument("2", "title 2", file);
    documents.add(document);

    envelopeDefinition = new EnvelopeDefinition();
    envelopeDefinition.setDocuments(documents);
    envelopeDefinition.setStatus("created");
    EnvelopeDocumentsResult envelopeDocumentsResult = envelopesApi.updateDocuments(accountId, envelopeSummary.getEnvelopeId(), envelopeDefinition);

回复

class EnvelopeDocumentsResult {
    envelopeId: a826c9f9-75f0-41bc-a958-537c45bc3918
    envelopeDocuments: [class EnvelopeDocument {
        documentId: 2
        name: null
        type: null
        uri: null
        order: 2
        pages: null
        containsPdfFormFields: null
        errorDetails: class ErrorDetails {
            errorCode: FORMAT_CONVERSION_ERROR
            message: The data could not be converted.
        }
    }]
}

1 个答案:

答案 0 :(得分:1)

我不确定&#39;文件&#39;变量是。但DocuSign API要求文件在Base64中编码。我知道EnvelopeDefinition类是如此复杂,所以我建议看一下这个例子并将代码片段与你的代码片段进行比较:https://www.docusign.com/developer-center/recipes/request-a-signature-via-email

另请分享envelopeDefinition.toString()(您可以匿名化任何敏感数据)!