【问题标题】:DocuSign Request error "Envelope definition missing."DocuSign 请求错误“信封定义丢失。”
【发布时间】:2017-07-03 14:18:21
【问题描述】:

我正在尝试使用 DocuSign REST api/v2 发出“createAndSendEnvelope”请求。我的 JSON 是有效的。

我遇到了同样的问题,我尝试了那里给出的解决方案,即我确保所有新行都使用'\r\n'。

我在这里缺少什么?这是我的请求,我收到错误代码“消息”:“信封不完整。完整的信封需要文档、收件人、标签和主题行。缺少信封定义。”

POST https://demo.docusign.net/restapi/v2/accounts/xxxxx/envelopes HTTP/1.1
X-DocuSign-Authentication: {"Username":"xxxxxx","Password":"xxxxx","IntegratorKey":"xxxxxx"}
Content-Type: multipart/form-data; boundary=AAA
Accept: application/json
Host: demo.docusign.net
Content-Length: 90500
Expect: 100-continue


--AAA
Content-Type: application/json
Content-Disposition: form-data
{
    "status": "sent",
    "recipients": {
        "signers": [{
            "tabs": {
                "signHeretabs": [{
                    "yPosition": "15",
                    "xPosition": "249",
                    "width": "100",
                    "tablabel": null,
                    "required": "TRUE",
                    "recipientId": "1",
                    "pagenumber": "1",
                    "fontSize": "Size12",
                    "font": "Calibri",
                    "documentid": "1",
                    "anchorYoffset": null,
                    "anchorXOffset": null,
                    "anchorUnits": "pixels",
                    "anchorString": "Sign Here",
                    "anchorIgnoreIfNotPresent": "true"
                }],
                "initialsTabs": [{
                    "yPosition": "45",
                    "xPosition": "249",
                    "width": "100",
                    "tablabel": null,
                    "required": "TRUE",
                    "receipientId": "1",
                    "pagenumber": "1",
                    "fontSize": "Size12",
                    "font": "Calibri",
                    "documentId": "1",
                    "anchorYoffset": null,
                    "anchorXOffset": null,
                    "anchorUnits": "pixels",
                    "anchorString": "Initials Here",
                    "anchorIgnoreIfNotPresent": "true"
                }],
                "dateSignedTabs": [{
                    "yPosition": "65",
                    "xPosition": "249",
                    "width": "100",
                    "tablabel": null,
                    "required": "TRUE",
                    "receipientid": "1",
                    "pagenumber": "1",
                    "fontSize": "Size12",
                    "font": "Calibri",
                    "documentid": "1",
                    "anchorYoffset": "-5",
                    "anchorXOffset": null,
                    "anchorUnits": "pixels",
                    "anchorString": "Date Signed",
                    "anchorIgnoreIfNotPresent": "true"
                }]
            },
            "routingorder": "1",
            "rolename": "roleNameHere",
            "recipientid": "1",
            "name": "XXXXXXXXXX",
            "email": "xxxxx@gcpa.com"
        }]
    },
    "emailsubject": "TestDocuSign Call",
    "emailBlurb": "Test Email Blurb",
    "documents": [{
        "name": "Name1",
        "fileExtension": ".pdf",
        "documentId": "1",
        "documentBase64": null
    }]
}
--AAA
Content-Type: application/octet-stream
Content-Disposition: file; filename="Name1.pdf"; documentid="1"
Content-Transfer-Encoding: base64
VGhpcyBpcyBh

【问题讨论】:

    标签: salesforce docusignapi


    【解决方案1】:

    您可以在 documentBase64 属性中指定 base64 编码的文档字节

    POST https://demo.docusign.net/restapi/v2/accounts/xxxxx/envelopes HTTP/1.1 X-DocuSign-Authentication: {"用户名":"xxxxxx","密码":"xxxxx","IntegratorKey":"xxxxxx"}

    内容类型:application/json

    {
     "status": "sent",
     "recipients": {
        "signers": [{
            "tabs": {
                    <Removed tabs for brevity>
            },
            "routingorder": "1",
            "rolename": "roleNameHere",
            "recipientid": "1",
            "name": "XXXXXXXXXX",
            "email": "xxxxx@gcpa.com"
        }]
     },
     "emailsubject": "TestDocuSign Call",
     "emailBlurb": "Test Email Blurb",
     "documents": [{
        "name": "Name1",
        "fileExtension": ".pdf",
        "documentId": "1",
        "documentBase64": "VGhpcyBpcyBh"
     }]
    }
    

    【讨论】:

    • 我尝试在 documentBase64 属性中指定文档字节,但仍然得到相同的错误。我正在尝试来自不是像 Java 这样的主流语言的这个请求,而是来自 SalesForce Apex 的请求,我认为这不应该导致这个问题。我希望错误消息更具体一点。
    • 您是否将内容类型更改为 application/json?
    • 是的,我做到了。下面是我的请求。删除标签以节省空间--AAA Content-Type: application/json Content-Disposition: form-data { "status": "sent", "recipients ": { "signers": [{}, }] }, "emailSubject": "TestDocuSign Call", "emailBlurb": "Test Email Blurb", "documents": [{ "name": "Name1 ", "fileExtension": ".pdf", "documentId": "1", "documentBase64": "VGhpcyBpcyBhIHNhbXBsZSBmaWxlIHVwbG9hZCBmb3IgdGVzdGluZy4=" }] } --AAA--
    • 如果您的内容类型为 application/json,则不应再指定边界。删除---AAA---
    • 另一个例子见这里stackoverflow.com/a/44726368/1219543
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多