首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DocuSign,cURL,json - from bash - error: ENVELOPE_IS_INCOMPLETE

DocuSign,cURL,json - from bash - error: ENVELOPE_IS_INCOMPLETE
EN

Stack Overflow用户
提问于 2016-08-25 01:47:09
回答 3查看 264关注 0票数 0

我的cURL有点生疏了,但我正在尝试做一个简单的测试,并用一个简单的单页.docx文件从V2 REST api文档中重新创建“基本场景”--“从文档创建信封”。

下面是我的curl命令:

代码语言:javascript
复制
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--'

我得到的错误是:

代码语言:javascript
复制
{
  "errorCode": "ENVELOPE_IS_INCOMPLETE",
  "message": "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line. Envelope definition missing."
}

哪个是可疑的实际上并不是问题所在。

我想我有一个cURL问题

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

提前感谢!!

EN

回答 3

Stack Overflow用户

发布于 2016-08-27 12:09:44

这与您的间距有关(并且您的json部分缺少一个} )。

如果您接受相同的请求并将其放入postman中,请删除所有尾随空格。它工作得很好。

票数 1
EN

Stack Overflow用户

发布于 2016-08-26 05:20:19

我也不能让您的cURL请求工作,但是这里有一个链接演示了另一种发送有效负载的方式:https://docs.docusign.com/esign/guide/usage/request_a_signature.html

需要指出的一件事(但不会影响当前的错误)是确保在您的文档中包含fileExtension,否则它将被假定为pdf:

代码语言:javascript
复制
"documents": [{ 
    "name": "test1.docx", 
    "documentId":"1", 
    "order":"1",
    "fileExtension" : "docx"
}], 
票数 0
EN

Stack Overflow用户

发布于 2017-01-05 05:26:04

事实证明,我做错了很多事,安德鲁和尼克都是对的。为了完整起见,这里是我的最终工作解决方案。

首先,bash脚本:

代码语言:javascript
复制
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字节内联插入到文档中,然后关闭它。当我看到nick的解决方案时,我做了这件事。通过@包含它不起作用,我必须使用'cat‘将其附加到实际的send.txt文件中

代码语言:javascript
复制
--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标头必须在换行符方面完全正确,一个额外的字符或缺少一个字符,它就会失败。

再次感谢你的帮助

哑光

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39129893

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档