繁体   English   中英

DocuSign,cURL,json-来自bash-错误:ENVELOPE_IS_INCOMPLETE

[英]DocuSign, cURL, json - from bash - error: ENVELOPE_IS_INCOMPLETE

我的cURL有点生锈,但是我试图做一个简单的测试并重新创建“基本方案”-从V2 REST api文档的“从文档创建信封”,并使用一个简单的.docx文件。

这是我的curl命令:

curl -X POST https://demo.docusign.net/restapi/v2/accounts/xxx/envelopes \
-H "X-DocuSign-Authentication: \
<DocuSignCredentials><Username>me/Username><Password>pp</Password><IntegratorKey>...</IntegratorKey></DocuSignCredentials>" \
-H "Accept: application/json" \
-H "Content-Type: multipart/form-data; boundary=AAA" \
-d '--AAA \
Content-Type: application/json \
Content-Disposition: form-data \
\
{ \
"status":"sent", \
"emailBlurb":"Test Email Body", \
"emailSubject": "Test Email Subject EnvelopeDefFull", \
"documents": [{ \
        "name": "test1.docx", \
        "documentId":"1", \
        "order":"1" \
}], \
"recipients": { \
"signers" : [{ \
        "email": "me@myemail.com", \
        "name": "my name", \
        "recipientId":"1" \
}] \
} \
--AAA \
Content-Type: application/docx \
Content-Disposition: file; filename="test1.docx"; documentid=1 \
 \
@test1.docx \
 \
--AAA--'

我得到的错误是:

{
  "errorCode": "ENVELOPE_IS_INCOMPLETE",
  "message": "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Envelope definition missing."
}

怀疑不是实际问题。

我认为我有一个卷曲问题

可能的问题:(1)-d单引号内的反斜杠(2)docx类型并通过@包含

提前致谢!!

它与您的间距有关(并且您在json部分缺少} )。

如果您接受相同的请求并将其扔给邮递员,请删除所有尾随空格。 它工作正常。

我也无法使您的cURL请求正常工作,但是以下链接演示了发送有效负载的另一种方法: https : //docs.docusign.com/esign/guide/usage/request_a_signature.html

需要指出的一件事(虽然不影响当前错误)是确保在文件中包含fileExtension ,否则将其视为pdf:

"documents": [{ 
    "name": "test1.docx", 
    "documentId":"1", 
    "order":"1",
    "fileExtension" : "docx"
}], 

好吧,事实证明我有很多错误,安德鲁和尼克都是正确的。 为了完整起见,这是我最后的工作解决方案。

首先,bash脚本:

curl -X POST --upload-file send.txt \
https://na2.docusign.net/restapi/v2/accounts/xxx/envelopes \
-H "Accept: application/json" \
-H "Content-Type: multipart/form-data; boundary=AAA" \
-H "X-DocuSign-Authentication: \
<DocuSignCredentials><SendOnBehalfOf>...</SendOnBehalfOf><Username>..</Username><Password>...</Password><IntegratorKey>...</IntegratorKey></DocuSignCredentials>"

现在,发送send.txt的内容。

请注意以下几点:我必须将文档转换为PDF,然后将PDF字节内联插入文档中,然后将其关闭。 当我看到尼克的解决方案时,我完成了此操作。 通过@包括它不起作用,我不得不使用'cat'将其附加到实际的send.txt文件中

--AAA
Content-Type: application/json
Content-Distribution: form-data

{
"status":"sent",
"emailBlurb":"...",
"emailSubject":"Renew...",
"compositeTemplates":[{
        "serverTemplates": [{
                "sequence":1,
                "templateId":"xxxx",
                "templateRoles":[
                ]
        }],
        "inlineTemplates":[{
                "sequence":2,
                "recipients": {
                        "signers" :
                                [{
                                "email": "s...@yahoo.com",
                                "name": "...",
                                "recipientId": "1",
                                "accessCode": "xxxx",
                                "roleName": "..."
                                },]
                        },
        }],
"document": {
        "name": "Renew.pdf",
        "documentId":"1",
},
}],"notification": {
        "UseAccountDefaults":"false",
        "reminders": {
                "reminderEnabled": "true",
                "reminderDelay": "3",
                "reminderFrequency": "10"
        },
        "expirations": {
                "expireEnabled": "true",
                "expireAfter": "7",
                "expireWarn": "1"
        },
},
}

--AAA
Content-Type: application/pdf
Content-Disposition: file; filename="Renew.pdf"; documentid=1

%PDF-1.4^M%âãÏÓ^M1 0 obj
<<
...pdf bytes here...
/Info 29 0 R
>>
startxref
84324
%%EOF

--AAA--

我必须使该应用程序专用的模板更简单,扩展或收缩的可能性较小,以便可以将签名标签以绝对坐标放置在文档上,而不是锚定。 交互使用的普通模板不起作用。

最后,HTML标头在换行符方面必须正确无误,一个或多个,否则会失败。

再次感谢您的帮助

马特

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM